Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

JavaScript QuickStart: Next Steps

Learn more about JavaScript and begin incorporating sctips into your Web pages.


advertisement

etting Your Hands Dirty
So, now you have a basic understanding of JavaScript and what it can do. If you're reading this, you've probably decided that you want to learn more about JavaScript and begin incorporating scripts into your Web pages.

The best way to begin working with JavaScript is to adapt existing scripts for your own use. Along the way, you'll begin to get a feel for the rhythm and flow of the language and eventually—if you're interested—begin writing your own scripts from scratch.

Explore a Script
When you first start to work with scripts, you'll probably be editing and adapting existing ones, rather than creating them from scratch.



Now that you understand some of the basic grammar rules in a JavaScript script, let's take a look at a script again. We'll look at each line as if it were a sentence and think about what it is "saying."

This script puts a little glowing dot in front of a menu choice when the reader puts the cursor over that menu choice. Click on the line in the code to see what it does. The explanations appear in a new, separate browser window. You can look at the script in action, the script code, and the descriptions of each portion of the script at the same time.

The first part of the script goes into the head of the HTML file:

1)     <script language="Javascript">
2)     <!--
3)     if (document.images) {
    markeron = new Image();
    markeron.src = "/images/jsimages/bullet.gif";
    markeroff = new Image();
    markeroff.src = "/images/jsimages/nobullet.gif";
}
4)    

function msover(num) {
    if (document.images){
    document.images[num].src = markeron.src;
    }
}

5)     function msout(num) {
    if (document.images){
    document.images[num].src = markeroff.src;
    }
}
//-->
6)     </script>

The second part of the script goes into the body of the file within different elements of the page.

This is what the HTML body that uses this script looks like. Click on any line for an explanation of what it does. The explanations appear in a new separate browser window. You can look at the script in action, the script code, and the descriptions of each portion of the script at the same time.

7)     <img src="/images/jsimages/nobullet.gif" width=20 height=20 alt="" vspace=1>
8)     <a href="E-response.htm" target=pcool onmouseover="msover(0) ; return true" onmouseout="msout(0)"><img src="/images/jsimages/bttn1.gif" width=162 height=16 border=0 vspace=1></a>
9)     <img src="/images/jsimages/nobullet.gif" width=20 height=20 alt="" vspace=1><a href="E-response.htm" target=pcool onmouseover="msover(2) ; return true" onmouseout="msout(2)"><img src="/images/jsimages/bttn2.gif" width=162 height=16 border=0 vspace=1></a><br clear=all >

<img src="/images/jsimages/nobullet.gif" width=20 height=20 alt="" vspace=1><a href="E-response.htm" target=pcool onmouseover="msover(4) ; return true" onmouseout="msout(4)"><img src="/images/jsimages/bttn3.gif" width=162 height=16 border=0 vspace=1></a>

<img src="/images/jsimages/nobullet.gif" width=20 height=20 alt="" vspace=1><a href="E-response.htm" target=pcool onmouseover="msover(6) ; return true" onmouseout="msout(6)"><img src="/images/jsimages/bttn4.gif" width=162 height=16 alt="Go to Project Cool" border=0 vspace=1></a>

Learn More
By now you've absorbed some basic information about JavaScript and what it can do for your site. Are you ready to learn more?

  • The next logical step is to explore the Project Cool JavaScript Zone. This section has the basics and reference for JavaScript.

  • Another step is to visit DevX.com's Get Help with JavaScript, to find answers to JavaScript script questions and other helpful information.

  • One more resource is DevX Search. Go to the scripts section and search for specfic scripting topics from different scripting resources.


   
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date