Question about multiple script blocks

Hello,

Whenever I can i of course combine multiple script tags into one. Is there any way to do that (aside from docwrite) if each one needs a wrapping div?

<div>
<script type=“text/javascript”>

&lt;/script&gt;

</div>
<div>
<script type=“text/javascript”>

&lt;/script&gt;

</div>
<div>
<script type=“text/javascript”>

&lt;/script&gt;

</div>

Why would you need a div for a script tag? They aren’t displayable… :shifty:

Two reasons. I floating 2 left. And to give it a height while JS is on so it doesn’t load like **** like sitepoint. The space is preserved.

Again, scripts are not displayed.

If you need the space, then fine, handle that through css. But wrapping scripts in divs don’t gain you anything…

Just put all the script tags just before the </body> tag. If the scripts are so antiquated that they don’t work when placed there then either update the script or replace it with a more modern one that works properly with modern browsers - the scripts that need to go earlier in the page are written for Netscape 4 and earlier.

If what the scripts are outputting need to be in div tags then place the div tags by themselves in the page where they need to go and give each an id that allows the associated JavaScript to reference it. The div tag can then be styled either from CSS or from the JavaScript.

They are adsense blocks. So they also have a large external script with each. Same script (link at least) but I can’t just say it once - stupid. So they load exactly where they are placed. I can probably get away without the wrapping divs. just means I have to make sense of the convoluted code and find the correct id to target.

I need to test this. But the adsense JS is very slow to load. So I thought I would wrap with the div to preserve the space to keep things from moving around once it loads.

Adsense uses primitive JavaScript using document.write and iframes (where a script intended for browsers more modern than the Netscape 4 browser that Google continue to write JavaScript for would use innerHTML and either a div or object tag).

You can move all the adsense scripts to the bottom of the page but it means adding even more JavaScript to the page that parses the antiquated document.write statements and converts them into JavaScript more suited to the middle ages (far more recent than the pre-dinosaur version that Google produce). See http://www.felgall.com/jstip148.htm for how to rewrite the adsense calls to use postscribe to allow the script to be placed at the bottom of the page where JavaScript belongs.