HTML and CSS Reference
In-Depth Information
With JavaScript, you may also use the language value "JavaScript 1.2" ,
indicating that the enclosed script is written for browsers that sup-
port version 1.2 of the language (most current browsers do). Version-
ing can be a problem, but it's not too severe. Netscape 2.0, for in-
stance, supports JavaScript 1.0 but does not process scripts identified
as "JavaScript 1.1" . Then again, what proportion of your audience is
still running Netscape 2.0?
12.3.1.2. The src and charset attributes
For particularly large JavaScript programs and ones you reuse often,
you should store the code in a separate file. In these cases, have the
browser load that separate file through the src attribute. The value of
the src attribute is the URL of the file containing the JavaScript program.
The stored file should have a MIME type of application/javascript , but
it will be handled automatically by a properly configured server if the fi-
lename suffix is .js .
For example:
<script type="text/javascript" src="http://www.kumquat.com/quatscript.js">
</script>
tells the <script> -able browser to load a JavaScript program named
quatscript.js from the server. Although there are no <script> contents,
the ending </script> still is required.
Used in conjunction with the src attribute, the charset attribute tells the
browser the character set used to encode the JavaScript program. Its
value is the name of any International Organization for Standardization
(ISO) standard character set encoding.
 
Search WWH ::




Custom Search