Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Home>>Hardware>>onMouseMove

onMouseMove

JAVAEOC
01-15-2004, 12:48 AM
why doesnt this work in NS?

<script>

function followmouse(){

document.getElementById('Trail').style.top = e.pageY
document.getElementById('Trail').style.left = e.pageX
}

document.onmousemove=followmouse
</script>
<style>
.Trail{
position: absolute;
top:0;
left: 0;
}
</style>

<body>
<img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"Image.gif" id="Trail" class="Trail">

DsgnrsTLZAdmin
01-15-2004, 02:00 AM
onmousemove? followmouse function? never seen that used before, that code seems serously wrong somehow but if it works in other browsers beside netscape then try this...



<head>
<script>

function followmouse()
{
document.getElementById('Trail').style.top = e.pageY
document.getElementById('Trail').style.left = e.pageX
}
document.onMouseMove="followmouse"
</script>
<style type="text/css">
.Trail{ position: absolute; top: 0; left: 0; }
</style>
</head>
<body>
<img src=http://www.codingforums.com/archive/index.php/http://www.codingforums.com/archive/index.php/"Image.gif" id="Trail" class="Trail">

nolachrymose
01-15-2004, 02:21 AM
function followmouse(evt) {
var n = document.getElementById('Trail');
n.style.left = evt.pageX;
n.style.top = evt.pageY;
}
document.onmousedown = followmouse;

Hope that helps!

Happy coding! :)

Vladdy
01-15-2004, 02:28 AM
Actually, the reason it does not work has nothing to do with capitalization. All lower case is right.
The reason it does not work in NS is that in IE the event object is global and therefore can be accessed from any function as you are doing. In Gecko, which follows the DOM2 Events, the event object is created for every event:

document.onmousemove = function(e)
{ window.status = 'Mouse position: ' + e.pageX + ' : ' + e.pageY;
}


 

TOP

For more info

setting a minimum size
Auto Preview of Image 
Refresh with a query s
JS Validation obsolete
Javascript Pop up func
Slide show transitions
I'm a newbie...please!
how to write coding in
Advanced Debug Info 
.js file doesn't work 

News Archive

Adding Graphic To Text
re-direct form after s
pop up window controls
Clock on homepage - He
passing a param from a
Password Procection wi
document.title in same
focus onload 
Counting Wrong from Ri
Help needed on how to 

Related stories:

document.title in same window.
focus onload
Counting Wrong from Right
Help needed on how to use an image for e-mail riddler?
Passing variables to another page AND disabling the toolbar
help with array please
Another newbie... cross browser forms

Copyright@2004-2005 www.zzcoke.com All Right Reserved

advanced web statistics