/    Sign up×
Community /Pin to ProfileBookmark

Problems with ImageFlip

OK here’s my source: (inside <HEAD></HEAD> tags)
[color=red]<SCRIPT LANGUAGE=”JavaScript”>
<!– hide from none JavaScript Browsers
Image1 = new Image()
Image1.src = “http://jenniferwhite.nexuswebs.net/images/galleries2.jpg
Image2 = new Image()
Image2.src = “http://jenniferwhite.nexuswebs.net/images/galleries_off.jpg
Image3 = new Image()
Image3.src = “http://jenniferwhite.nexuswebs.net/images/links2.jpg
Image4 = new Image()
Image4.src = “http://jenniferwhite.nexuswebs.net/images/links_off.jpg
Image5 = new Image()
Image5.src = “http://jenniferwhite.nexuswebs.net/images/radiostuff2.jpg
Image6 = new Image()
Image6.src = “http://jenniferwhite.nexuswebs.net/images/radiostuff_off.jpg
Image7 = new Image()
Image7.src = “http://jenniferwhite.nexuswebs.net/images/listenerrambles2.jpg
Image8 = new Image()
Image8.src = “http://jenniferwhite.nexuswebs.net/images/listenerrambles_off.jpg

//GALLERIES
function SwapOut() {
document.imageflip.src = Image2.src; return true;
}

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

//LINKS
function SwapOut2() {
document.rollover.src = Image4.src; return true;
}

function SwapBack2() {
document.rollover.src = Image3.src; return true;
}

//RADIO STUFF
function SwapOut3() {
document.concerts.src = Image6.src; return true;
}

function SwapBack3() {
document.concerts.src = Image5.src; return true;
}

//LISTENER RAMBLES
function SwapOut4() {
document.players.src = Image8.src; return true;
}

function SwapBack4() {
document.players.src = Image7.src; return true;
}</SCRIPT>[/color]

and here’s my actual HTML containg the function for the script:

[color=blue]<A HREF=”http://jenniferwhite.nexuswebs.net/galleries.html” onMouseOver=”SwapOut()” onMouseOut=”SwapBack()”>
<IMG NAME=”imageflip” SRC=”http://jenniferwhite.nexuswebs.net/galleries2.jpg” BORDER=0 alt=”[galleries]”></A><P>
<A HREF=”links.html” onMouseOver=”SwapOut2()” onMouseOut=”SwapBack2()”>
<IMG NAME=”rollover” SRC=”http://jenniferwhite.nexuswebs.net/links2.jpg” BORDER=0 alt=”[links]”></A><P>
<A HREF=”http://jenniferwhite.nexuswebs.net/radiostuff.html” onMouseOver=”SwapOut3()” onMouseOut=”SwapBack3()”>
<IMG NAME=”concerts” SRC=”http://jenniferwhite.nexuswebs.net/radiostuff2.html” BORDER=0 alt=”[radio stuff]”></A><P>
<A HREF=”http://jenniferwhite.nexuswebs.net/listen.html” onMouseOver=”SwapOut4()” onMouseOut=”SwapBack4()”>
<IMG NAME=”players” SRC=”http://jenniferwhite.nexuswebs.net/listenerrambles2.jpg” BORDER=0 alt=”[listener rambles]”></A><P>[/color]

So can anyone please tell me why it keeps doing [url=http://jenniferwhite.nexuswebs.net/fun.html]THIS[/url] when it should look the same as my [url=http://jenniferwhite.nexuswebs.net]homepage[/url]?!? Many thanks

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 05.2004 — You are using SwapOut() for all links and not SwapOut2() etc.
Copy linkTweet thisAlerts:
@djjenyauthorMay 05.2004 — eh? I am I think u'll find...
<A HREF="http://jenniferwhite.nexuswebs.net/galleries.html" onMouseOver="SwapOut()" onMouseOut="SwapBack()">

<IMG NAME="imageflip" SRC="http://jenniferwhite.nexuswebs.net/galleries2.jpg" BORDER=0 alt="[galleries]"></A><P>

<A HREF="links.html" onMouseOver="SwapOut2()" onMouseOut="SwapBack2()">

<IMG NAME="rollover" SRC="http://jenniferwhite.nexuswebs.net/links2.jpg" BORDER=0 alt="[links]"></A><P>

<A HREF="http://jenniferwhite.nexuswebs.net/radiostuff.html" onMouseOver="SwapOut3()" onMouseOut="SwapBack3()">

<IMG NAME="concerts" SRC="http://jenniferwhite.nexuswebs.net/radiostuff2.html" BORDER=0 alt="[radio stuff]"></A><P>

<A HREF="http://jenniferwhite.nexuswebs.net/listen.html" onMouseOver="SwapOut4()" onMouseOut="SwapBack4()">

<IMG NAME="players" SRC="http://jenniferwhite.nexuswebs.net/listenerrambles2.jpg" BORDER=0 alt="[listener rambles]"></A><P>[/QUOTE]
Copy linkTweet thisAlerts:
@FangMay 06.2004 — and now it's not working because the JavaScript functions have been removed.
Copy linkTweet thisAlerts:
@djjenyauthorMay 06.2004 — Uh. I was quoting my previous post. If you look at my first post, you'll see that all the code is fine, the functions are there and I've numbered my image flips. So why isn't it wokring?
Copy linkTweet thisAlerts:
@theBody44May 06.2004 — Your images aren't very large so you won't have to worry too much about pre-loading them. Try this script, it will shorten your work and your code immensly...


<head>

<script>

function swapOut(myImage){

var temp = myImage.src.indexOf(".");

var url = myImage.src.substring(0, (temp-1));

myImage.src = (url + "_off.jpg");

}

function swapBack(myImage){

var temp = myImage.src.indexOf(".");

var url = myImage.src.substring(0, (temp-4));

myImage.src= (url + ".jpg");

}

</script>

</head>

<body>

<a href="...."><img src="..." onMouseOver="swapOut(this)" onMouseOut="swapBack(this)">

....(for all four images/links)


This of course is assuming that your swapOut images have the extensions "_off" before the ".jpg" and are lacking the "2". I think I anylized your code correctly and this should work for your purposes. If not, let me know.
Copy linkTweet thisAlerts:
@FangMay 06.2004 — The JavaScript works and the html is fine.

The page you gave as a link has no JavaScript and now no events ?
×

Success!

Help @djjeny 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.9,
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,
)...