Basics of Javascript

The following example shows how should we write the java script


< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



< html xmlns="http://www.w3.org/1999/xhtml" lang="en">



< head>



< title>JavaScript Hello World< / title>



< meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />



< / head>



< body>



< h1 align="center">First JavaScript



< hr />



< script type="text/javascript">



document.write(" Hello Every one! ");



< / script>



< / body>



< / html>


Using the < script > element allows the browser to differentiate between what is JavaScript and what is (X)HTML markup or regular text.

If we want to show the text "Hello Every one! " then it should be shown something in this way..


< strong>



< script type="text/javascript">



document.write("Hello World from JavaScript!");



< / script>



< / strong>


but it can not be shown in this way....

< script type="text/javascript">


< strong>



document.write("Hello World from JavaScript!");



< / strong>



< / script>

0 comments:

Post a Comment