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. Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.