JavaScript Prompt for User Input in a Custom HTML Prompt

I am trying to learn various fundamentals in using both JavaScript and Custom HTML prompts.

This very short demonstration works as a standalone web page in a browser. Why does it not prompt me for input however when used as a custom. HTML prompt in KM?

Number Average Test


/* query for 3 numbers.  Display the average */
var num1 = prompt('Enter a number');
var num2 = prompt('Enter a number');
var num3 = prompt('Enter a number');
var avg = (parseInt(num1) + parseInt(num2) + parseInt(num3)) / 3;
document.write('The average is ' + avg);


If I recall, the KM implementation of WebKit used in the Custom HTML Prompt does not support prompt() or alert(), among a few other JS functions.

1 Like

In the KM Editor, use the menu item "Window->Macro Library" - there's a couple of good examples there. Also, there's plenty of examples in this forum also.

1 Like