Adding JavaScript to a Web Page part 3

The <script> Tag



The <script> tag can take two attributes, language and type, which specify the script's type:<script language="javascript" type="text/javascript">

</script>

The language attribute is deprecated, and should not be used.
In the example below, we created an alert box inside the script tag, using the alert()function.
<html>
<head>
<title></title>
<script type="text/javascript">
alert("This is an alert box!");
</script>

</head>
<body>
</body>
</html>
Try It Yourself

Result:
The type attribute: <scripttype="text/javascript"> is also no longer required, as JavaScript is the default HTML scripting language.
What attribute and what value is used along with the script tag?
<script 
 
 
="text/
 
 
">

Comments

Popular posts from this blog

Introducing object part 3

Comparison Operators part 2

Module 2