mpsn Posted December 18, 2011 Share Posted December 18, 2011 Hi, why doesn' this simple script run? <html> <head> <script type="text/javascript"> function show_prompt() { var name=prompt("Please enter your name","Harry Potter"); if (name!=null && name!="") { var text = document.getElementsById("p_1").innerHTML = "What's up, " + name + "?"; } } </script> </head> <body> <input type="button" onclick="show_prompt()" value="Show prompt box" /> <p id="p_1">Initial text</p> </body> </html> Any help appreciated. Link to comment https://forums.phpfreaks.com/topic/253410-innerhtml-doesnt-change-in-prompt-box/ Share on other sites More sharing options...
mpsn Posted December 18, 2011 Author Share Posted December 18, 2011 **my mistake: it's getElementById, NOT getElementsById Link to comment https://forums.phpfreaks.com/topic/253410-innerhtml-doesnt-change-in-prompt-box/#findComment-1298963 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.