Re: JavaScript Question

by Thomas James Allen <tjallen(at)pipeline.com>

 Date:  Sat, 27 Nov 1999 11:53:03 -0500
 To:  tjtmd(at)attglobal.net
 Cc:  hwg-basics(at)hwg.org
  todo: View Thread, Original
At 10:35 AM 11/27/99 -0500, you wrote:
>Hi
>What is the proper syntax for an HTML document containing several JS
>event handlers?
>Shaould <SCRIPT></SCRIPT> appear anywhere?
>Also is there a good clear tutorial for JavaScript?
>Thank you
>Tanya
>--------------------------
Tanya,
I'm not sure I completely understand you, but this might help.

Javascript events are typically handled by functions, which are
"called" when an event occurs. There will be two bits of code
involved, the code that calls the function, and the function itself.

The code that calls the function is placed within the usual html code,
for example, within an img statement like this:
<img src="imagename.gif" onmouseover="functionName()">
In this case, the code says, when the user mouseovers the image,
run the javascript function named "functionName()".

There can be numerous instances of this function caller throughout the
html code, calling the same, or different functions.

The code for the functions themselves is typically placed in the HEAD
section of the html document, so it will load before the page loads. It is
surrounded by <SCRIPT></SCRIPT>. If there are several functions involved,
you can put all of them within one set of <SCRIPT></SCRIPT>. 
It will look like this:

<SCRIPT language="javascript">
<!-- this hides the code from non-javascript browsers

function functionName1() {
        js code of functionName1
}

function functionName2() {
        js code of functionName2
}

function functionName3() {
        js code of functionName3
}

// end of hiding-->
</SCRIPT>

As for good online javascript tutorials, they are usually
bits and pieces of js code & explanations like these at CNET:
http://www.builder.com/Programming/Scripter/greatest.html
There are more at various places, which others will recommend.
I personally don't know of a good, complete js tutorial, except
in old-fashioned paper books. Maybe others can help here.

Hope this helps,
jimmy
---
Jimmy Allen (Thomas James Allen)
Business - Get Your Website Here
http://www.getyourwebsitehere.com
Personal - Eclecticity
http://www.getyourwebsitehere.com/personal

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA