PDA

View Full Version : Use JavaScript to pict between to different HTML tags.


PhotoJoe
07-19-2002, 03:47 AM
I have pages that are coded the same except for this little bit of code. Which comes from the page that works in IE

<!-- This works with NS and <span> tag works with IE
<div id="butterfly" style="position: absolute; top: 0; left: 0;">
<img name="pic" border="0" src="images/Other/monarch3_flap_md_clr.gif"
width="70" height="80">
</div>
-->

<span id="butterfly"><img name="pic" border="0"
src="images/Other/monarch3_flap_md_clr.gif"
style="position: absolute; top: 0; left: 0;" width="70" height="80"></span>

The following code comes from the NS page that works:

<div id="butterfly" style="position: absolute; top: 0; left: 0;">
<img name="pic" border="0" src="images/Other/monarch3_flap_md_clr.gif"
width="70" height="80">
</div>

<!-- // This code works for IE only have to use the above <div> tag for NS
<span id="butterfly"><img name="pic" border="0"
src="images/Other/monarch3_flap_md_clr.gif"
style="position: absolute; top: 0; left: 0;" width="70" height="80"></span>
<div align="left">
-->

So I guess I need a javascript funtion that will test for browser type and use the correct tag but I not quite sure how I get javascript to insert these lines of html code.

Link to the page that works with Internet Explore. (http://www.bottomlee.com/IEhome_10.htm)

Link to the page that works with Netscape. (http://www.bottomlee.com/NShome_10.htm)

thanks,

Mrs G
07-19-2002, 07:01 PM
why not use the DIV tag for both?

PhotoJoe
07-20-2002, 12:18 AM
Originally posted by Mrs G
why not use the DIV tag for both?

For reasons I'm not sure of the the <div> tags cause the javascript for the butterfly gif not float around like I want, it only sits in the upper right hand corner when view with IE. If you have IE try clicking on the Netscape link in my previous post and you will see what I mean.