Forum Moderators: open

Message Too Old, No Replies

problem to swap text and image in IE 6

problem to swap text and image in IE 6

         

gabe986

6:31 pm on Nov 14, 2007 (gmt 0)

10+ Year Member



Hi, I'm a graphic designer and not a programmer so I'm pulling my hair out with the code below. I have 4 thumbnails that on click should swap a big image and change out a small text description. It works in all important browsers except IE 6. Can anyone help?

I could send the url to the site if this helps to understand the problem — I'm just not sure if thats ok with the posting guidelines. This is my first post :)

Thank you

<a href="javascript:;" onClick="MM_changeProp('testspan','','innerHTML','A faux wood finish, indistinguishable from a natural wood, conceals very dark stain that once covered this ceiling.','SPAN')"><img src="portfoliopics/pic1-thumb.jpg" name="pfthumb1" width="116" height="91" border="0" id="pfthumb1" onMouseDown="MM_swapImage('pic1','','portfoliopics/pf_pic1.jpg',1)"></a><a href="javascript:;" onClick="MM_changeProp('testspan','','innerHTML','SFP&D can duplicate any tile design onto just about any surface.','SPAN')"><img src="portfoliopics/pic2-thumb.jpg" name="pfthumb2" width="109" height="91" border="0" id="pfthumb2" onMouseDown="MM_swapImage('pic1','','portfoliopics/pf_pic2.jpg',0)"></a><br />
<a href="javascript:;" onClick="MM_changeProp('testspan','','innerHTML','SFP&D applied a lightly tinted glaze to cover walls that were a bit too pink for the new owner.','SPAN')"><img src="portfoliopics/pic3-thumb.jpg" name="pfthumb3" width="116" height="110" border="0" id="pfthumb3" onMouseDown="MM_swapImage('pic1','','portfoliopics/pf_pic3.jpg',1)"></a><a href="javascript:;" onClick="MM_changeProp('testspan','','innerHTML','These antiques tiles were badly cracked and chipped before our flawless restoration.','SPAN')"><img src="portfoliopics/pic4-thumb.jpg" name="pfthumb4" width="109" height="110" border="0" id="pfthumb4" onMouseDown="MM_swapImage('pic1','','portfoliopics/pf_pic4.jpg',1)"></a>

mehh

7:26 pm on Nov 15, 2007 (gmt 0)

10+ Year Member



you would be hard pressed to find someone who would read through that.

Generic code:

<script type="text/javascript">
var srcTxt=[
["image1.jpg","The first image"],
["Flower.png","Aww. Perty flower"]
];
function swap(id){
var cont=document.getElementById("cont");
var img=document.createElement('img');
var p=document.createElement('p');
var src=srcTxt[id][0];
var txt=srcTxt[id][1];
img.src=src;
p.appendChild(document.createTextNode(txt));
cont.innerHTML="";
cont.appendChild(img);
cont.appendChild(p);
}
window.onload=function(){swap(0)};
</script>
<div id="cont"></div>
<a href="#" onclick="swap(0)">First Image</a>
<a href="#" onclick="swap(1)">Flower</a>

untested but should work

gabe986

10:24 pm on Nov 15, 2007 (gmt 0)

10+ Year Member



Cool. I will try it out. Thanks so much for your help.