Home  |  About  | Last |  Submit  |  Contact
AllQuests.com



Previous Question:  Extra Fast Cf Memory  iPAQ h2200 seriesNext Question:  can i overlay object to create the illusion of a drop shadow  CSS
Question why doesnt this work? ( SitePoint Forums JavaScript )
Updated: 2008-03-09 03:09:01 (6)
why doesnt this work?

I have this mouse following script, which does not want to work. Please help me. It doesnt have an error message but does not work the way I intend it to and I cant find the problem with it. Here is the code:



<html>
<head>
<title>Follow that Mouse!</title>
<script language="JavaScript">

var blltnum = 7;
var bllt = new Array(blltnum);
var Xpos = 0;
var Ypos = 0;
var cntr = 0;


function setup() {
for (var i = 0; i<blltnum; i++) {


bllt[i] = document.getElementById("bllt" + i).style;
bllt[i].left = i * 20;
bllt[i].top = i * 20;


}
animate();
}

function getMouse() {
Xpos = window.event.x;
Ypos = window.event.y;
}

function animate() {

if (cntr == 0) {
bllt[cntr].left = Xpos + 5;
bllt[cntr].top = Ypos + 10;
}
else {
bllt[cntr].left = bllt[cntr-1].left;
bllt[cntr].top = bllt[cntr-1].top;
}


cntr++;

if (cntr > blltnum - 1) {
cntr = 0;
}
var t = setTimeout("animate();", 10);
}


</script>
</head>
<body onload="setup();" onmousemove="window.status='X=' + window.event.x + ', Y=' + window.event.y; getMouse();">

<div ID="bllt0"" style="position:absolute; z-index:10;">
<img src="pongball1.jpg">
</div>
<div ID="bllt1"" style="position:absolute; z-index:9;">
<img src="pongball1.jpg">
</div>
<div ID="bllt2"" style="position:absolute; z-index:8;">
<img src="pongball1.jpg">
</div>
<div ID="bllt3"" style="position:absolute; z-index:7;">
<img src="pongball1.jpg">
</div>
<div ID="bllt4"" style="position:absolute; z-index:6;">
<img src="pongball1.jpg">
</div>
<div ID="bllt5"" style="position:absolute; z-index:5;">
<img src="pongball1.jpg">
</div>
<div ID="bllt6"" style="position:absolute; z-index:4;">
<img src="pongball1.jpg">
</div>


</body>
</html>

Answers: why doesnt this work? ( SitePoint Forums JavaScript )
why doesnt this work?

What exactly is the problem? It works fine in IE6...

weirdbeardmt

why doesnt this work?

I have IE 5.5 and it hides 5 other balls. It works fine with the 2 balls that follow, but the other 5 balls either arent there or they go directly under the second one so it looks like there are only 2 balls. As far as I can see it looks like it should work fine but it isnt working like it should.

joekarbakuitz

why doesnt this work?

Hmm, admittedly I had no image, but in IE6 it only looked like there was ONE ball!?

weirdbeardmt

why doesnt this work?

So do you know what the problem is, cause if you did that would be really helpful.

joekarbakuitz

why doesnt this work?

I have played about with it a lot, but unfortunately can't find the solution. Sorry.

weirdbeardmt

why doesnt this work?

Thanks for your help anyways, i appreciate it.

joekarbakuitz

Previous Question:  Extra Fast Cf Memory  Brighthand.com Smartphone and PDA Discussion Forums  iPAQ h2200 seriesNext Question:  can i overlay object to create the illusion of a drop shadow  SitePoint Forums  CSS

- Source: why doesnt this work? SitePoint Forums JavaScript
- Previous Question: Extra Fast Cf Memory Brighthand.com Smartphone and PDA Discussion Forums iPAQ h2200 series
- Next Question: can i overlay object to create the illusion of a drop shadow SitePoint Forums CSS