Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
4094
The <script> tag (XHTML Reference)
Introduction
The <script> tag is used to define a block, which is
used for a scripting language. Script languages are mostly used to calculate or
to do something else with data. For example, you can ask the user for his name
print it out, but remember that this code should be in the script block. A
script block is usually placed in a <head> tag; but if you want you can
put it anywhere you like – even in a separate script file. Furthermore you can
include any amount of script tags, as you like.
Example
<SCRIPT language='javascript'>
function GetName()
{
var name =
prompt('Enter your name please','');
document.write('hello
');
document.write(name);
}
</script>
<title>Get Current Date</title>
</head>
<body onload="javascript:GetName();">
</body>
</html>
Output
After entering Sonu and pressing the OK button the following
screen appears.
Attributes
Name:
Description:
charset
Defines the character coding of the target url or writes a
page on charset.
defer
This is an empty attribute and forbids the script to
generate any document content.
event
The script will be run only when a specific event occurs.
for
Defines the ID of the element, which the script is valid
for.
language
Defines the scripting language.
src
Defines a URL or path of the file which contains the
script code.
type
Defines the mime type of the script. Can be one of the
following: