Javasript Codes
Javasript Codes
<html>
<body>
<script type="text/javascript">
document.write("Hello World!");
</script>
</body>
</html>
output on an HTML page: Hello World!
Sometimes you might want to run the same JavaScript on several pages, without having to write
the same script on every page.
To simplify this, you can write a JavaScript in an external file. Save the external JavaScript file with
a .js file extension.
To use the external script, point to the .js file in the "src" attribute of the <script> tag:
<html>
<head>
<script src="xxx.js"></script>
</head>
<body>
</body>
</html>