... but I need the same solution to work in both browsers.
prompt (and his cousin alert ) are very outdated. You do not control their appearance or position. It is best to avoid them.
Instead, you can make a pop-up message using an absolutely positioned div (or any other block element), which not only gives you full control over its position, but also full style. If you look around, you will find dozens of examples of this and the tools for this, you do not need to roll on your own if you really do not want it.
No matter how you end up doing this, your logic using it will have to change because prompt is synchronous (all scripts on the page go to screech and wait for prompts), whereas modern methods are asynchronous (oriented to developments). So, for example, your new code for using a popup may look like this:
function showUpdate() { popup("Please enter your name","", function(name) { if (name!=null) { x="Hello " + name + "! How are you today?"; alert("Input : "+name);
source share