Tuesday, April 20, 2010

Javascript HTML tags

Javascript HTML


In order to use javascript in a html document, you need a HTML file. A typical HTML file looks like this




<html>
<body>
This is a HTML document
</body>
</html>


Inline


You can either put your script in the html document like so




<html>
<body>
<script>
alert('Hello World');
</script>
This is a HTML document
</body>
</html>


External


or in an external file names script.js




<html>
<body>
<script language="JavaScript" src="script.js"></script>
This is a HTML document
</body>
</html>

No comments:

Post a Comment