JavaScript Tutorial 1.1: The Very Basics




This tutorial will cover the really basic things about JavaScript, mainly proper syntax of strings, method of script inclusion, and the commonly used alert() and document.write().

To those of a keen eye, you’ll get a glimpse of my recent history at 1:33, and for that I apologize.

“absolutely necessity”: that should be “absolute.”

The error message display comes courtesy of Firebug, an incredibly useful Firefox add-on.

The song is Beethoven’s Ninth Symphony.

(Those with epilepsy should stop watching this tutorial about ten seconds before its end to be safe…)

Original source


34 responses to “JavaScript Tutorial 1.1: The Very Basics”

  1. My code not working
    <script type-'text/javascript'>
    window.onload – BG_change;

    function BG_change()
    {
    document.body.style.backgroundColor – 'rgb(' +
    Math.floor(Math.random() * 256) + ',' +
    Math.floor(Math.random() * 256) + ',' +
    Math.floor(Math.random() * 256) + ')';
    setTimeout('BG_change()', 50);
    }
    </script>

  2. Trying to make a flashy background too… Not working though. What am I doing wrong?

    <script type='text/javascript'>
       window.onload – BG_change;
     
       function BG_change()
    {
    document.body.style.backgroundColor – 'rgb(' +
    Math.floor(Math.random() * 256) + ',' + 
    Math.floor(Math.random() * 256) + ',' + 
    Math.floor(Math.random() * 256) + ')';
    setTimeout('BG_change()', 50);
     } 
    </script>

Leave a Reply