Introduction to JavaScript and the Web
Introduction to JavaScript and the Web
The <SCRIPT> tags has a number of attributes, but the most important
one for us is the LANGUAGE attributes. JavaScript is not the only scripting
language available, and different scripting languages need to be
processed in different ways. We need to tell the browser which scripting
language to expect, so that it knows how to process it
Opening Script Tag:
<SCRIPT LANGUAGE = “JavaScript”>
Sample Program1: Sample Program2:
<HTML> <HTML>
<BODY BGCOLOR="WHITE">
<BODY <P>Paragraph 1 </P>
BGCOLOR="WHITE"> <SCRIPT LANGUAGE="JavaScript">
//Script block 1
<P>Paragraph 1 </P> alert("First Script Block");
<SCRIPT </SCRIPT>
LANGUAGE="JavaScript" <P>Paragraph 2 </P>
<SCRIPT LANGUAGE="JavaScript">
> //Script block 2
document.bgColor = document.bgColor = "RED";
alert("Second Script Block");
"RED"; </SCRIPT>
</SCRIPT> <P>Paragraph 3 </P>
</BODY> </BODY>
</HTML
</HTML>
alert( ) functions enables us to alert or inform the user
about something by displaying a message box.