anmldr Posted October 20, 2009 Share Posted October 20, 2009 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 More sharing options...
chibineku Posted October 20, 2009 Share Posted October 20, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.