Define message in one block and output it in another : Source File « Language Basics « JavaScript Tutorial






<html>
<head>
<title>Define message in one block and output it in another</title>

<script language="javascript" type="text/javascript">
<!--

var msg  = "Message in javascript";

//-->
</script>

</head>
<body>

<h1>Define message in one block and output it in another</h1>

<script language="javascript" type="text/javascript">
<!--

document.write("<P>" + msg + "</p>");

//-->
</script>

</body>
</html>








1.7.Source File
1.7.1.Use the 'script' tag to incluse your javascript code
1.7.2.HTML Template Page supporting the JavaScript
1.7.3.Define script in HEAD section
1.7.4.Define javascript code in BODY section
1.7.5.Define message in one block and output it in another
1.7.6.Reference javascript source file stored outside
1.7.7.Mix simple code with HTML
1.7.8.Mix complicated code with HTML