Jump to content

Prompt Box In Safari


anmldr
 Share

Recommended Posts

Why does the JS for the Prompt box on W3Schools not work in Safari?http://www.w3schools.com/JS/js_popup.aspAfter clicking on the button in the Prompt, the page is blank.

<html><head><script type="text/javascript">function show_prompt(){var name=prompt("Please enter your name","Harry Potter");if (name!=null && name!="")  {  document.write("Hello " + name + "! How are you today?");  }}</script></head><body><input type="button" onclick="show_prompt()" value="Show prompt box" /></body></html>

Linda

Link to comment
Share on other sites

It's actually document.write() that isn't working - try swapping it for alert() and it works just fine. Document.write is not a good tool anyway, so its no sad loss.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...