Toggle navigation
☰
Home
HTML
CSS
Scripting
Database
<!DOCTYPE html> <title>My Example</title> <script> document.addEventListener("DOMContentLoaded", function(event) { var e = document.getElementById("go"); e.addEventListener( "click", function() { var name=prompt("What is your name?","Homer"); if ( name!=null && name!="" ) { output = "Well " + name + ". You seem very daring!"; } else { output = "Hey, I asked you your name!"; } document.getElementById( "msg" ).innerText = output; }, false); }); </script> <!-- Replace '{action page}' with your own action page to support non-JavaScript users --> <form name="myForm" action="{action page}"> <input id="go" type="button" value="I dare you to click me!"> </form> <p id="msg"></p>