:: JavaScript FAQ
::
Where should the SCRIPT go in my HTML? The
safest place to put your <SCRIPT LANGUAGE="JavaScript"> </SCRIPT>
tags is within the <HEAD> tags. This will force it to be loaded into the
browser's memory first. If you put code anywhere else there's always a chance
that a user might click on an image or link before your code has been fully
loaded, resulting in errors and a poor impression of your coding abilities.
Here's an example:
<HTML> < HEAD> < TITLE>My
Example</TITLE>
<SCRIPT LANGUAGE="JavaScript> < !-- HIDE FROM OLD
BROWSERS
Javascript code goes here // -->STOP HIDING <
/SCRIPT> < /HEAD>
<BODY> HTML goes here < /BODY> </HTML>
2. Is there any online documentation for
JavaScript? Yes, there is at Netscape's Javascript Reference As the
originators of Javascript, their information is the most up to date.
3. Is there a version of the documentation that I can view offline
on my computer? Yes, there is. A zipped (compressed) version of the
above online documentation from Netscape is available at Netscape
4.
Is Microsoft doing anything with Javascript? As a matter of fact,
Microsoft is. However, Microsoft have a different implementation of Javascript
called JScript which basically means that some Javascript functions are either
not implemented in JScript or performed in a different manner. You can find more
information at Microsoft's JScript Reference site Don't forget to check up
Microsoft's document object model at Microsoft's JScript site
5. Are
there any differences between Javascript and Microsoft's
JScript?Funny you should mention that, as a matter of fact, there
are some differences between Javascript and JScript. There have been some
rumours that future versions of Internet Explorer will support the full
implementation of Javascript but this remains to be seen (especially as
Microsoft would prefer people to use VBScript).
In answer to your question: Jscript is the Microsoft term
used to refer to Internet Explorer's version of Javascript. Jscript does not
currently support the more interesting features of Javascript, and it also
improperly uses many of the common Javascript features. This has led to some
sites using Javascript not appearing correctly when viewed using Internet
Explorer. Unfortunately this has led to some people to believe Javascript is at
fault rather than the implementation by the browser.
The following Javascript items are not implemented in
JavaScript:
6. Are there any books on
Javascript? As a matter of fact there are plenty of books on
Javascript and a few on Microsoft's implementation of Javascript (JScript). Here
are just a few:
The Javascript Bible by Danny Goodman Using JScript (Special
Edition) - Quo Javascript Sourcebook - Wiley Using Javascript -
Quo Practical Javascript Programming - Javascript for Dummies -
IDG Javascript Quick Reference for Dummies - IDG Javascript The Definitive
Guide by David Flanagan (I highly recommend this book) JavaScript Application
Cookbook by Jerry Bradenhaugh
7. Is there a way I can use Javascript to protect
myself against spammers? Yes there is, rather than embed your email
address in a web page you have created, consider using a short piece of
javascript code that generates your email address on the fly. The disadvantage,
of course is that people who don't have a Javascript enabled browser won't be
able to see your email address. However it will prevent spammers using programs
to scan email addresses from web pages from grabbing your email address. I've
included the code on my Javascript samples page. I cannot claim credit for the
code however, I found it at the excellent site http://www.wsabstract.com. The
code originated from the people at http://www.cdrsoft.com and is easy to modify
for your own pages. |