java_script

Discussion in 'Javascript' started by java.inet@gmail.com, Apr 23, 2007.

  1. Guest

    internally how to run java script means where to start the evaluation
    in the
    <head >
    tag or
    <body> tag and how to run
     
    , Apr 23, 2007
    #1
    1. Advertising

  2. VK Guest

    On Apr 23, 10:58 am, wrote:
    > internally how to run java script means where to start the evaluation
    > in the
    > <head >
    > tag or
    > <body> tag and how to run


    It depends on the task you want to accomplish.

    1) Your script is used as an alternate input stream on page load. In
    this case place your script wherever the output has to go:

    <body>
    .....
    <script>
    document.write('Hello, world!');
    </script>
    ....
    </body>

    2) Your script is used to communicate with DOM interface after page
    load. In this case place it into head section and run on page load -
    so after the DOM Tree is completed. Please note that after that you
    cannot use document.write method but only DOM methods - new output
    stream on open will clear up the existing page.

    <head>
    ....
    <script defer>

    function init() {
    var p = document.createElement('P');
    p.innerHTML = '<strong>Hello, wold!</strong>';
    document.body.appendChild(p);
    }

    window.onload = init;
    </script>
    ....
    </head>
     
    VK, Apr 23, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. java_script

    , Apr 24, 2007, in forum: Javascript
    Replies:
    3
    Views:
    80
Loading...

Share This Page