/    Sign up×
Community /Pin to ProfileBookmark

Problem with javascript – IE, Netscape and Firefox

I’m hoping someone can help me with this. I have a friend who runs circles around me as far as javascript goes and he can’t figure it out either.

[B]Here’s the problem:[/B]
I’m using Dreamweaver which has a simple Swap Image script. That script works fine in all 3 of the browsers I mentioned. However, I wanted the script to do one more thing other than swap and image. Here’s a link so you can see what I mean: [url]http://www.craddockcunningham.com/experience_project.php?ID=50&categoryID=1[/url]

See those three images at the bottom right. Well, when you click those the larger image above them should change. This works great in Firefox. However, in IE the image doesn’t change.
I think it is because of the additional line added to Dreamweaver’s script. Here’s a snippet of the script and then the implementation lines within the body of the page:

[code]//script:
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];
if(a.length==5) jobpicurl.href=a[i+4];}
}

//intermediate image code:
<a href=”/images/experiences/118-fullsize.jpg” target=”_blank” name=”jobpicurl” id=”jobpicurl”> <img src=”/images/experiences/118-large.jpg” alt=”Click for Larger Image” name=”jobpicph” width=”225″ height=”200″ border=”0″ id=”jobpicph”></a>

//thumbnail code:
<a href=”javascript:;” onClick=”MM_swapImage(‘jobpicph’,”,’/images/experiences/118-large.jpg’,1,’/images/experiences/118-fullsize.jpg’)”><img
src=”/images/experiences/118-thumbnail.jpg” alt=”Image 1″ name=”jp01″ width=”50″ height=”44″ border=”0″ id=”jp01″></a>[/code]

To add a little more complexity…I also wanted to make the href for the larger image change so that you could click it and see an even larger image in a new window. The last line in the script was added to check to see if the swapImage arguments equaled 5 which would mean I was supplying the link for the full sized image. If so, it changes the href “jobpicurl” to the url indicated in the argument for the function call under the thumbnail code.

[B]So, here’s how the 3 browsers shape up:[/B]
IE – the intermediate image does not display when you click the thumbnails. However, if you click where the image SHOULD be, then the correct full size image does come up in the new window.
Netscape 7 – Intermediate image changes but the link to the full size image always goes to the first image. It doesn’t change with the intermediate image. Netscape 8, since it is built on Firefox works fine in both respects.
Firefox – Works flawlessly!

So, there’s my problem. Can anyone have a peek at this and tell me something to try?

Thanks!!!
Matt Tyree

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@ExuroJul 08.2005 — It all works just fine for me in Firefox 1.0.4 and IE6. I don't get any errors and the 3 sizes of each of the 3 pictures seem to display just fine...
Copy linkTweet thisAlerts:
@TyreeauthorJul 08.2005 — Yeah, it should all work fine now. Someone showed me how to change it. Sorry, I forgot to write on here that I got it fixed.

Thanks!

Matt
×

Success!

Help @Tyree 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.19,
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,
)...