/    Sign up×
Community /Pin to ProfileBookmark

linking an arrray image to a new page?

Do you know how to link an array image to a page withour clicking on the array? I a m making a website for a high school class where if a countdown reaches zero, you lose, but I don’t know how to get to the you lose page when the countdown reaches zero. Any help would be appreciated.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisJan 17.2008 — When the countdown reaches zero, change the window.location to the "you lose" page.
Copy linkTweet thisAlerts:
@ChuckinsauthorJan 17.2008 — I'm pretty new to computer programming so I'm not exactly sure what you mean. Here is my code that I have so far. Sorry for any trouble this may cause you.

P.S. I think if then statement is very wrong.

Thanks

<!>

<!>

<!2008>

<!DOCTYPE html

PUBLIC"-//W3C//DTD xhtml 1.0-transitional//EN"

"http://www.w3.org/TR/xhtml1-transitional.dtd">

<html>

<head>

<title>Question 3</title>

<link rel="stylesheet" type="text/css" href="styles1.css"/>

<script type="text/javascript">

<!--Hide from old browsers

var rotatorMsg=new

Array("three.bmp","two.bmp","one.bmp","zero.bmp")

var rotatorCntr=3

function RotateIt() {

rotatorCntr+=1

if(rotatorCntr==4) rotatorCntr=0

document.Rotate.src = rotatorMsg[rotatorCntr]

setTimeout("RotateIt()",1200)

if(function RotateIt().var rotatorMsg.new

Array="zero.bmp")

then(framedef.main="wronganswer3.htm")

}

//-->

</script>

<script type="text/javascript">

<!--Hide from old browsers

function moveRight() {

document.all['Img2'].style.pixelLeft=610

document.all['Img2'].style.pixelTop=135

}

function moveBack() {

document.all['Img2'].style.pixelLeft=10

document.all['Img2'].style.pixelTop=135

}

//-->

</script>

<style type="text/css">

#ImgText1 {position: absolute; top=260; left=10;}

#Img1 {position: absolute; top=160; left=700;}

#Img2 {position: absolute; top=135; left=10;}

</style>

</head>

<body onload="RotateIt()">

<font size="+5">3.<br>Inoculate before the virus infects your

computer!</font>

<span id="Img1"><img src="lab11-1virus.jpg" height="90"

width="90" /></span>

<span id="Img2"><img src="lab11-1inoculate.jpg" height="130"

width="90" /></span>

<span id="ImgText1"><a href="question4.htm"

onmouseover="moveRight()"

onmouseout="moveBack()">Inoculate</a></span>

<br><br><br><br><br><br><br><br><br><br>

<font size="+3">

Countdown:<br>

<img src="three.bmp" alt="countdown" name="Rotate" height="100"

width="100"/>

</font>






</body>

</html>
Copy linkTweet thisAlerts:
@vwphillipsJan 17.2008 — rotatorCntr will be 0 on the first call so I have mage to 3

and corrected/tidied your code

[CODE]<!DOCTYPE html PUBLIC"-//W3C//DTD xhtml 1.0-transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd">

<html>

<head>

<title>Question 3</title>
<link rel="stylesheet" type="text/css" href="styles1.css"/>
<script type="text/javascript">
<!--Hide from old browsers
var rotatorMsg=["http://www.vicsjavascripts.org.uk/StdImages/Three.gif","http://www.vicsjavascripts.org.uk/StdImages/Two.gif","http://www.vicsjavascripts.org.uk/StdImages/One.gif","http://www.vicsjavascripts.org.uk/StdImages/Zero.gif"];
var rotatorCntr=3;

function RotateIt() {
rotatorCntr+=1;
if(rotatorCntr==4) rotatorCntr=0;
document.getElementById('Rotate').src = rotatorMsg[rotatorCntr];
if (rotatorCntr==3) window.top.location='http://www.vicsjavascripts.org.uk/';
setTimeout("RotateIt()",1200)
}

//-->
</script>

<script type="text/javascript">
<!--Hide from old browsers
function moveRight() {
document.getElementById('Img2').style.left='610px';
document.getElementById('Img2').style.top='135px'
}
function moveBack() {
document.getElementById('Img2').style.left='10px';
document.getElementById('Img2').style.top='135px';
}
//-->
</script>
<style type="text/css">
#ImgText1 {position: absolute; top:260px; left:10px;}
#Img1 {position: absolute; top:160px; left:700px;}
#Img2 {position: absolute; top:135px; left:10px;}
</style>
</head>
<body onload="RotateIt()">
<font size="+5">3.<br>Inoculate before the virus infects your

computer!</font>

<span id="Img1"><img src="lab11-1virus.jpg" height="90" width="90" /></span>
<span id="Img2"><img src="lab11-1inoculate.jpg" height="130" width="90" /></span>
<span id="ImgText1"><a href="question4.htm" onmouseover="moveRight()" onmouseout="moveBack()">Inoculate</a></span>
<br><br><br><br><br><br><br><br><br><br>
<font size="+3">
Countdown:<br>
<img src="three.bmp" alt="countdown" id="Rotate" height="100" width="100"/>
</font>






</body>
</html>
[/CODE]
Copy linkTweet thisAlerts:
@ChuckinsauthorJan 18.2008 — I used your code and it worked perfectly. Thank you so very much. I really appreciate what you guys are doing on this site and it is really a big help. Thanks again!?
×

Success!

Help @Chuckins 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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