Printer Friendly Version
Using the <script> Tag
If you are putting this in an XHTML document, you can use /> to close the script tag, rather than immediately following it with </script>, but this is not valid HTML and may or may not work depending on the browser.
You will notice I added two additional optional attributes to the example above. The charset attribute is used to define the charset of the data between the script tags. The defer="defer" is the only valid use of the defer element. It tells the browser that the rest of the page does not depend on the contents of this file in order to load and therefore the browser can defer loading the file or load it simultaneously with the rest of the page. This would be useful, for instance, if you were loading functions that would be called in response to user actions.
This site needs an editor - click to learn more!
View This Article in Regular Layout
Content copyright © 2013 by Julie L Baumler. All rights reserved.
This content was written by Julie L Baumler. If you wish to use this content in any manner, you need written permission. Contact Editor Wanted for details.