Advanced Search

Results 1 to 9 of 9

Thread: Mouse animation issue

  1. #1
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Mouse animation issue

    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

  2. #2
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Can any one please help me now - i really gotta now !!!

  3. #3
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    C'mon please ???

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Problem:
    You can't use document.getElementById outside of the body, which you have done. Also, you cannot define a variable within a variable:
    Code:
    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:
    Code:
    document.getElementById('ctext').style.left=event.clientX
    var a = document.getElementById('ctext').style.left
    - Mike

  5. #5
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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???
    Last edited by pcbrainbuster; 02-18-2007 at 08:50 PM.

  6. #6
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 ???

  7. #7
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Nope, I was referring to any browser in general... oh, and get Mozilla FireFox. Internet Explorer has a really un-standard reputation.
    - Mike

  8. #8
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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

  9. #9
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    So can anyone help me with the animation part ???
    Please? Stronger Please?
    Last edited by pcbrainbuster; 02-20-2007 at 06:05 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •