html - display date in javascript -
trying teach myself javascript. however, cannot figure out why following code doesn't work. ideas?
<!doctype html> <html> <body> <p> click button display date</p> <button onclick="showdate()">hit me</button> <script> function displaydate() { document.getelementbyid("test").innterhtml=displaydate(); } </script> <p id="test"></p> </body> copy , pasted wrong, here actual code:
<!doctype html> <html> <body> <p> click button display date</p> <button onclick="showdate()">hit me</button> <script> function showdate() { document.getelementbyid("test").innterhtml=date(); } </script> <p id="test"></p> </body>
document.getelementbyid("test").innterhtml=date(); should be
document.getelementbyid("test").innerhtml=date();
Comments
Post a Comment