PDA

View Full Version : Mouse animation issue



pcbrainbuster
02-18-2007, 05:48 AM
Well hellow there everyone,

I have this script which is basically supposed to make the cursor (edited) that is supposed to go from event.clientX to event.clientX+10 adding 1 each time can anyone please tell me wht exactly went wrong -

<html>
<head>
<script>
var a = document.getElementById('ctext').style.left=event.clientX
var b = document.getElementById('ctext').style.left=event.clientX+100
function asd() {
if (a<b) {
a++
document.getElementById('ctext').style.left=event.clientX+a
document.getElementById('ctext').style.top=event.clientY
aase=setTimeout("asd()",10)}
else {
document.getElementById('ctext').style.left=event.clientX
document.getElementById('ctext').style.top=event.clientY}
}
</script>
<body bgcolor="black" onmousemove="asd()">
<div align="center">
<span id="ctext" style="position: absolute;"><img src="1.gif"><font color="yellow">FEAR ME</font><img src="1.gif"></span>
</div>
</body>
</head>
</html>

So plz can any1 help me off here :),
Thanks For Your Time :D

pcbrainbuster
02-18-2007, 10:18 AM
Can any one please help me now - i really gotta now !!! :(

pcbrainbuster
02-18-2007, 09:28 PM
C'mon please ???

mburt
02-18-2007, 09:37 PM
Problem:
You can't use document.getElementById outside of the body, which you have done. Also, you cannot define a variable within a variable:

var a = document.getElementById('ctext').style.left=event.clientX
You are trying to assign ctext's style left to event.clientX within a variable which cannot be done. Use:

document.getElementById('ctext').style.left=event.clientX
var a = document.getElementById('ctext').style.left

pcbrainbuster
02-18-2007, 09:43 PM
WOW i did'nt now about the document part but the second part is not completely understood, i mean i have written that it s equal to event.

Anyway seriously thanks for the reply - KNOWLEGDE EQUALS POWER

(actully nooo that's a lie if someone had two bazookas and a turret facing your way knowlegde would not do anything it would probably come out the other side of your head LOL)

But the thing is what about the animation, what's wrong with it???

pcbrainbuster
02-18-2007, 10:15 PM
I did a few more tests on the document in head statement but it did not matter were document.getElementById was it just worked -

I am workin with ie7 here, were you refering to an older version or other browsers ???

mburt
02-18-2007, 10:37 PM
Nope, I was referring to any browser in general... oh, and get Mozilla FireFox. Internet Explorer has a really un-standard reputation.

pcbrainbuster
02-19-2007, 04:46 PM
Yeah, well I just can't do that :)

Because for one thing I did'nt know there was any browser out there then internet explorer, i only found out last year !!! And I am tooooo used to it, if i let go i won't be able to do everything i do now i mean I only know ie scripting (even though there all similar) i simply plan to keep it that way :)

pcbrainbuster
02-19-2007, 11:31 PM
So can anyone help me with the animation part ???
Please? Stronger Please?:)