/    Sign up×
Community /Pin to ProfileBookmark

swap image problem in dreamweaver

I am using dreamweaver for a swap image behavior but the swap image doesn’t upload in Internet Explorer 6. It uploads fine in Netscape. Should I use different javascript? I want to swap an image on click and restore on click. I have thumbnail images as the onclick links. Please help!!!

[url]http://www.kandmnursery.com/10_hang…ing_basket.html[/url]

Here’s the javascript;

<script language=”JavaScript”>
<!–
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
//–>
</script>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@johneboyJan 22.2005 — all that to swap image on click?

<i>
</i>&lt;script&gt;
function swapImg(i1,i2){
var img1 = new Image();
var img2 = new Image();
img1.src = i1;
img2.src = i2;

if (document.getElementById("samImg").src == img1.src){
document.getElementById("samImg").src = img2.src;
}else{
document.getElementById("samImg").src = img1.src;
}
}
&lt;/script&gt;
&lt;img src="1.gif" id=samImg onclick=swapImg('1.gif','2.gif')&gt;
×

Success!

Help @regfl spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...