Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26917 > unrolled thread

Is it any fifference where I put the script tag in this example

Started by"Tony Johansson" <johansson.andersson@telia.com>
First post2015-02-24 00:09 +0100
Last post2015-02-24 20:46 +0700
Articles 5 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Is it any fifference where I put the script tag in this example "Tony Johansson" <johansson.andersson@telia.com> - 2015-02-24 00:09 +0100
    Re: Is it any fifference where I put the script tag in this example "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-02-24 00:24 +0100
    Re: Is it any fifference where I put the script tag in this example "Tony Johansson" <johansson.andersson@telia.com> - 2015-02-24 00:30 +0100
    Re: Is it any fifference where I put the script tag in this example Denis McMahon <denismfmcmahon@gmail.com> - 2015-02-24 00:09 +0000
      Re: Is it any fifference where I put the script tag in this example JJ <jj4public@vfemail.net> - 2015-02-24 20:46 +0700

#26917 — Is it any fifference where I put the script tag in this example

From"Tony Johansson" <johansson.andersson@telia.com>
Date2015-02-24 00:09 +0100
SubjectIs it any fifference where I put the script tag in this example
Message-ID<mcgbvo$45v$1@dont-email.me>
Hello!

Just assume that I have a very simple script tag that looks like this
<script>
      document.write("This is a test");
</script>

Then is it just the equivalent if I put this script tag within header tag or 
within the body tag.

//Tony 

[toc] | [next] | [standalone]


#26918

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2015-02-24 00:24 +0100
Message-ID<mcgcs6$v4v$1@solani.org>
In reply to#26917
Tony Johansson wrote:

> Just assume that I have a very simple script tag that looks like this
> <script>
>      document.write("This is a test");
> </script>
> 
> Then is it just the equivalent if I put this script tag within header
> tag or within the body tag.

I suggest you try it out.  You'll notice the difference quickly.

BTW: it is not a script *tag*, but rather a script *element*.

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#26919

From"Tony Johansson" <johansson.andersson@telia.com>
Date2015-02-24 00:30 +0100
Message-ID<mcgd6i$8cq$1@dont-email.me>
In reply to#26917
Forget the question!

//Tony

"Tony Johansson" <johansson.andersson@telia.com> skrev i meddelandet 
news:mcgbvo$45v$1@dont-email.me...
> Hello!
>
> Just assume that I have a very simple script tag that looks like this
> <script>
>      document.write("This is a test");
> </script>
>
> Then is it just the equivalent if I put this script tag within header tag 
> or within the body tag.
>
> //Tony 

[toc] | [prev] | [next] | [standalone]


#26920

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-02-24 00:09 +0000
Message-ID<mcgffh$gs7$7@dont-email.me>
In reply to#26917
On Tue, 24 Feb 2015 00:09:41 +0100, Tony Johansson wrote:

> Just assume that I have a very simple script tag that looks like this
> <script>
>       document.write("This is a test");
> </script>

> Then is it just the equivalent if I put this script tag within header
> tag or within the body tag.

No.

This particular script element will write the text "This is a test" into 
the document at the point you insert the script tag.

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [next] | [standalone]


#26924

FromJJ <jj4public@vfemail.net>
Date2015-02-24 20:46 +0700
Message-ID<1l1aewx934aot.inlkuipqcvfd.dlg@40tude.net>
In reply to#26920
On Tue, 24 Feb 2015 00:09:21 +0000 (UTC), Denis McMahon wrote:
> On Tue, 24 Feb 2015 00:09:41 +0100, Tony Johansson wrote:
> 
>> Just assume that I have a very simple script tag that looks like this
>> <script>
>>       document.write("This is a test");
>> </script>
> 
>> Then is it just the equivalent if I put this script tag within header
>> tag or within the body tag.
> 
> No.
> 
> This particular script element will write the text "This is a test" into 
> the document at the point you insert the script tag.

And then be moved into the document body if the script element is within the
document head. Interestingly, how this is exactly done, varies accross
different browser engines.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web