Javascript


Who runs it?
Javascript is run by the browser, not by the server.  That means it places no load on the server.  That means that is has no access to server-based resources, like databases and files.

What about security?
Javascript runs in a sandbox.  It cannot access the local filesystem, the local printer, and other things too.

What's Javascripts relationship to Java?
Java had a cool name.  Javascript stole it.

Are there things that can only be done in Javascript?

Yes.  Totally.  And some very cool things too.

What's the hard part about programming Javascript?
Netscape and IE do Javascript differently.  That's uncool.
There are so many objects.  Pretty much every cool thing you want is setting the value of some object.  So you have to memorize all the objects.
Everything else you want is an event.  There are so many events.  So you have to memorize all the events.

How do I write Javascript?
There are two basic ways.  You can either put code inside an HTML tag, and the code will run when the tag is activated.

<A HREF="mylink.htm" onMouseOver="window.status='Click here to know more about me'; return true;" onMouseOut="window.status=''; ">Click here</A>


Or you can place code in the main portion of the file, and the code will run when that portion is loaded.

<SCRIPT LANGUAGE="JavaScript">
<!--
document.write("Last updated :");
document.write(document.lastModified);
// -->

</SCRIPT>


Can I use Javascript to validate input data?
Kinda.  Javascript can check to make sure input data is valid.  But the server cannot be confident that the Javascript has not been altered or disabled.  Javascript can help users produce valid data, but cannot provide guarentees to the server.

What about Javascript types?
Javascript is pretty typeless, rather like Perl or PHP.  One can say all of the following things:
i = 2;
i = i + "10";    // gives 12
i = "10" + 2;   // gives "102"



Where can I learn more?