JavaScript Tutorial/Language Basics/Source File
Содержание
Define javascript code in BODY section
<source lang="javascript">
<html> <head> </head> <body>
Page heading
<script> alert("Do you see the page heading?"); </script> </body> </html></source>
Define message in one block and output it in another
<source lang="javascript">
<html> <head> <title>Define message in one block and output it in another</title> <script language="javascript" type="text/javascript">
</script> </head> <body>
Define message in one block and output it in another
<script language="javascript" type="text/javascript">
</script> </body> </html></source>
Define script in HEAD section
<source lang="javascript">
<html> <head> <script> alert("Do you see the page heading?"); </script> </head> <body>
Page heading
</body> </html></source>
HTML Template Page supporting the JavaScript
<source lang="javascript">
<html> <head> <title>HTML Template Page</title> <script language="javascript">
</script> </head> <body> </body> </html></source>
Mix complicated code with HTML
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body>
Click here to specify quantity
</body> </html></source>
Mix simple code with HTML
<source lang="javascript">
<html> <head> <title>A Simple Page</title> <script language="JavaScript">
</script> </head> <body>
Click here to specify quantity
</body> </html></source>
Reference javascript source file stored outside
<source lang="javascript">
<html> <head> <title>Title of Document</title> <script src="path-to-file/fileName.js"></script> </head> <body> The content of your page goes here. </body> </html></source>
Use the "script" tag to incluse your javascript code
<source lang="javascript">
<html> <head> <title>Title of Document</title> <script> // All Your Javascript Code goes In Here Between the opening and closing script tags. </script> </head> <body> The content of your page here. </body> </html></source>