My Profile

Tuesday, February 1, 2011

How to write Java Script ?

We can write javascript in different ways.

Now we'll see the different methods to write Java script.

Method 1: Writing Java script along with HTML flow.

Just like HTML statements, we can write JS statements also directly in a page and it will be executed in sequenced flow. Only difference is we must indicate to browsers that we are written Java script code. To do that we have:

                   <script language="javascript">
                        --------Java script statements----

Let's see an example to make it clear


    <title>Java Script Method 1</title>
    <h1>Java Script Method 1 demo</h1>
    <h1>This is HTML</h1>
    <script language="javascript" type="text/javascript">
      document.write("This is java Script");
    <h2>Back to HTML</h2>


** If you like this post please like our page in facebook "Dot Net Support


Post a Comment


Twitter Delicious Facebook Digg Stumbleupon Favorites More