PDA

View Full Version : Trick when two scripts do not work



lassew859
01-09-2006, 01:29 PM
Hi

Here is a trick you can use if two scripts on the same page do not work.

However the trick only works if the script operates on a separate part of the page - i.e. a messagebox.

Just create an iframe and put the script in this page. To get it to look nice you have to adjust the iframe so no scrollbars are shown.

Regards

Lars

Twey
01-09-2006, 04:07 PM
If the forums are searched, you'll find many examples of this advice being given to people (although I wouldn't always agree, due to the necessity of involving iframes). However, it's not in the sticky, and I believe it needed to be said.

Oh: don't forget to remove the border, too.
<iframe style="border-style:none;overflow:hidden;" src="myscript.html"/>

jscheuer1
01-09-2006, 07:08 PM
Oh: don't forget to remove the border, too.
<iframe style="border-style:none;overflow:hidden;" src="myscript.html"/>

That doesn't remove the border in IE which also requires the old style of tag closure for this tag, for that you need:


<iframe frameborder="0" src="myscript.html"></iframe>

Overflow for the external page is controlled by its body's style, or you can use the scrolling="no" attribute for the iframe tag. Other refinements are often necessary to get the x-browser 'look and feel' one is after using this method. It still can be far easier than rewriting scripts, unless the problem is only a simple onload event conflict.