/    Sign up×
Community /Pin to ProfileBookmark

trouble with more than one image flip

? i am using this javascript for my image flip.

SCRIPT LANGUAGE=”JavaScript”>
<!– hide from none JavaScript Browsers
Image1= new Image(260,390)
Image1.src = “1116127656.jpg”
Image2 = new Image(260,390)
Image2.src = “1116127655.jpg”

function SwapOut() {
document.image2.src = Image2.src; return true;
}

function SwapBack() {
document.image2.src = Image1.src; return true;
}

// – stop hiding –>
</SCRIPT>

On the web site it says to change the imageflip word in document.imageflip.src under swapback to something else for another image flip. but when i do this it causes the script right above it to not work. it is the exact same script but i have changed the word imageflip in the script and the command.

(use IE)

to post a comment
HTML

1 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 17.2005 — You can do it like this:&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;swap images&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;

&lt;script type="text/javascript"&gt;
&lt;!--
var photo=[];
photo[0]=new Image(75, 100);
photo[0].src="../Images/apple.jpg";
photo[0].alt="apple";
photo[1]=new Image(75, 100);
photo[1].src="../Images/orange.jpg";
photo[1].alt="orange";
photo[2]=new Image(75, 100);
photo[2].src="../Images/pear.jpg";
photo[2].alt="pear";
photo[3]=new Image(75, 100);
photo[3].src="../Images/banana.jpg";
photo[3].alt="banana";

function swapImage(obj, num) {
obj.src=photo[num].src;
obj.alt=photo[num].alt;
}
//--&gt;
&lt;/script&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;img onmouseover="swapImage(this, 1);" onmouseout="swapImage(this, 0);" alt="apple" src="../Images/apple.jpg"&gt;
&lt;img onmouseover="swapImage(this, 3);" onmouseout="swapImage(this, 2);" alt="pear" src="../Images/pear.jpg"&gt;
&lt;/body&gt;
&lt;/html&gt;
×

Success!

Help @nox_5 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...