StupidScript
11th August 2004, 06:53 PM
[Comment moved from SEO Checklist by StupidScript]
About the only thing the HTML4 DTD has to do with Javascript is the way the <script> tag is written. Javascript is a separate technology (developed by Netscape and not related to Sun's Java except for marketing reasons).
The tag should look like one of these, when it's finished:
<script language="javascript" type="text/javascript">
functions andStuff() {
}
</script>
--- or ---
<script language="javascript" type="text/javascript" src="site.js"></script>
--- or ---
<script language="javascript" type="text/javascript" src="site.js" defer=1></script>
(The last one tells the browser that you won't be using Javascript to write anything on the page ( i.e. document.write() ) so it can go ahead and render the page without waiting.)
Sometimes you see the version of Javascript in the "language" attribute ( i.e. language="Javascript1.2" ), but it makes no difference to the browser. In fact, the "language" attribute is deprecated in favor of the "type" (MIME-type) attribute, and is only included for backwards compatibility.
If a browser is having trouble rendering the menu, it's probably the browser. If it's your composition tool, then it's probably the tool reacting to the DTD as if it mattered to the script.
Perhaps your script writes non-conforming elements, so it's not the script, per se, but what you are doing with it that doesn't meet the spec.
After you're done editing in your composition program, check the syntax in, say Notepad or SimpleText to see the real deal, and adjust as necessary.
(See: http://www.w3c.org/TR/REC-html40/interact/scripts.html section 18.2.1 for the full <script> definition.)
About the only thing the HTML4 DTD has to do with Javascript is the way the <script> tag is written. Javascript is a separate technology (developed by Netscape and not related to Sun's Java except for marketing reasons).
The tag should look like one of these, when it's finished:
<script language="javascript" type="text/javascript">
functions andStuff() {
}
</script>
--- or ---
<script language="javascript" type="text/javascript" src="site.js"></script>
--- or ---
<script language="javascript" type="text/javascript" src="site.js" defer=1></script>
(The last one tells the browser that you won't be using Javascript to write anything on the page ( i.e. document.write() ) so it can go ahead and render the page without waiting.)
Sometimes you see the version of Javascript in the "language" attribute ( i.e. language="Javascript1.2" ), but it makes no difference to the browser. In fact, the "language" attribute is deprecated in favor of the "type" (MIME-type) attribute, and is only included for backwards compatibility.
If a browser is having trouble rendering the menu, it's probably the browser. If it's your composition tool, then it's probably the tool reacting to the DTD as if it mattered to the script.
Perhaps your script writes non-conforming elements, so it's not the script, per se, but what you are doing with it that doesn't meet the spec.
After you're done editing in your composition program, check the syntax in, say Notepad or SimpleText to see the real deal, and adjust as necessary.
(See: http://www.w3c.org/TR/REC-html40/interact/scripts.html section 18.2.1 for the full <script> definition.)