Simple javascript not working. What's up with that?

Discussion in 'Software' started by longbowrocks, Feb 20, 2010.

  1. longbowrocks

    longbowrocks Private E-2

    So I'm learning javascript, and everything was going smoothly until I tried writing a simple script to practice Date constructors. from the start my array iteration seems to fail, and after trying a few times, I can no longer get
    alert("gawd I'm annoyed");
    to do anything regardless of its placement in the script section. Can I get some help?
    here's the code (there may be a few syntax errors since I've been screwing around with it, but I'm certain the actual problem is implementation):

    <html>
    <head>
    <script type="text/javscript">
    <!--
    var dateArray = new Array(4);
    dateArray[0] = new Date(9000000);
    dateArray[1] = new Date("October 13, 1975 11:13:00");
    dateArray[2] = new Date(79,5,24);
    dateArray[3] = new Date(79,5,24,11,33,0);

    function get_dates(){
    var i;
    for(i = 0; i < dateArray.length; i++){
    document.write(dateArray + "<br />");
    }
    }
    //-->
    </script>
    </head>
    <body>
    <input type="button" value="Display different dates" onclick="get_dates()" />
    </body>
    </html>
     
  2. SWario

    SWario Sergeant

    You misspelled "javascript", which caused the failure.
     
  3. longbowrocks

    longbowrocks Private E-2

    ...Really? If it turns out that was the problem I'm going to laugh harder than the first time I discovered internet humor.
     
  4. longbowrocks

    longbowrocks Private E-2

    Oh my god, that was it. THANK YOU! Now I can go back to how I originally planned to do this!
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds