Javascript Code
by Linda Quinn
Close Window
This page describes how to embed javascript in an HTML document.
Script in <BODY>
This example has the script element in the <body> element.
The browser will execute this code as soon as it is downloaded from the server.
<html>
<head>
<body>
<script language="Javascript" type="text/javascript">
... code goes here ...
</script>
</body>
</head>
</html>
Script in <HEAD>
This example has the script element in the <head> element.
The browser will try to run this when it loads, so usually code in the head
element contains functions which are run when called.
<html>
<head>
<script language="Javascript" type="text/javascript">
... code goes here ...
</script>
</head>
</html>
External script
This example references an external javascript file.
The browser will handle the external file by downloading it and executing it.
<html>
<head>
<script type="text/javascript" src="jsfile.js">
</script>
</head>
</html>
=================================================================
This content was created by Linda Quinn of LQNet.
See http://www.lqnet.com for a great
collection of articles on this and other topics.
=================================================================
Copyright © 2006-2008, LQ Systems,Inc. All rights reserved.
====================================================================
Want an expert to help with your project?
LQ Systems, Inc.
Business Solutions
====================================================================