Declaring a Function in the 'head' Block : Function « Language Basics « JavaScript DHTML
- JavaScript DHTML
- Language Basics
- Function
Declaring a Function in the 'head' Block
<html>
<head>
<title>JavaScript Unleashed</title>
<script type="text/javascript">
<!--
function defaultColors() {
document.writeln("Inside of defaultColors()");
document.fgColor = "black";
document.bgColor = "white";
}
// -->
</script>
</head>
<body>
<script type="text/javascript">
<!--
document.writeln("Functions are scripts just waiting to run!");
defaultColors();
document.writeln("All done.");
// -->
</script>
</body>
</html>
Related examples in the same category