Simple javascript events: alert using inline and traditional methods -


i have been looking @ following code few minutes , problem escaping me. how can make each of these events produce alerts work?

<html>  <head></head>  <body>  [ <span id="trad_alert">traditional alert</span> ]  [ <span onclick="inlinealert ();">inline alert</span> ]  <script type="txt/javascript"> document.getelementbyid("trad_alert").onclick = function () {     alert ("traditional alert"); }  function inlinealert () {     alert ("inline alert"); } </script>  </body></html> 

searching stackoverflow or web produce numerous examples appear identical i'm trying, yet mine continues fail.

your script type wrong.

either change <script type="text/javascript"> or remove type altogether.


Comments