Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image swap in Firefox not working?!?

Status
Not open for further replies.

remco5897

Technical User
Oct 27, 2001
48
NL
I am trying to change the source of an image. Works fine in IE but not in Firefox. Can anybody see what I am doing wrong?

The new image is loaded and then new dimensions (
width, height) are applied.


The code below can just be copied and pasted in your favourite editor:

<html>
<head>
<script type="text/javascript">
function SwapMe(ImageID)
{
var x = document.getElementById(ImageID);
x.attributes.src.value = ' ImageWidth = x.attributes.MyWidth.value;
ImageHeight = x.attributes.MyHeight.value;
x.attributes.width.value = ImageWidth;
x.attributes.height.value = ImageHeight;
}
</script>
</head>
<body>
<div onclick="SwapMe('Image1')">click me!</div>
<div id="imageholder001" name="imageholder001" class="imageholder001">
<img id="Image1" src=" MyWidth="1000" MyHeight="667" ContainingDiv="imageholder001" width="348px" height="80px" alt="my picture" title="title2" />
</div>
</body>
</html>
 
works fine for me in IE 6 and FF 1.0 on Win XP Pro



=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Jeff,

Thanks a lot for telling me this! I am using Win 98 with IE6 and Firefox 1.0.

This was really getting up my nose and to be honest I haven't even considered the operating system part of the problem.

I'll leave the code as it is.

Thanks ...


remco
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top