- JavaScript was designed to add interactivity to HTML pages
- JavaScript is a scripting language
- A scripting language is a lightweight programming language
- JavaScript is usually embedded directly into HTML pages
- JavaScript is an interpreted language (means that scripts execute without preliminary compilation)
- Everyone can use JavaScript without purchasing a license
JavaScript – Syntax
<html>
<body>
<script type=”text/javascript”>
…
</script>
</body>
</html>
<body>
<script type=”text/javascript”>
…
</script>
</body>
</html>
JavaScript Comments
- Singl Line Comments
- Multiline comments
Single Line Comments Examples:
<html> <head> <title>A Simple Page</title> <script language="javascript"> <!-- // The first alert is below alert("An alert triggered by JavaScript!"); // Here is the second alert alert("A second message appears!"); // --> </script> </head> <body> </body> </html>
Multiline comments Examples:
<html> <head> <title>A Simple Page</title> <script language="javascript"> <!-- /* Below two alert() methods are used to fire up two message boxes - note how the second one fires after the OK button on the first has been clicked */ alert("An alert triggered by JavaScript!"); alert("A second message appears!"); // --> </script> </head> <body> </body> </html>
0 comments:
Post a Comment