Hi guys,
I want to use a Curser position function with javascript like this:
This isn't the problem, this'll work. But when I include the javascript file Prototype.js it won't work anymore, an error will show.
The error is 'variable e is not defined'
this code won't work:
(I'm using Prototype 1.5.0 btw)
Can anyone help me? I really need the Javascript Framework and the mousepos function working.
I want to use a Curser position function with javascript like this:
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
function test(){
var posx = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
var posy = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
alert(posx+","+posy);
}
</script>
</head>
<body>
<input name="test" type="button" value="click me" onClick="test();"/>
</body>
</html>
The error is 'variable e is not defined'
this code won't work:
Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/prototype.js" type="text/javascript"></script>
<script language="javascript">
function test(){
var posx = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
var posy = (window.Event) ? e.pageY : event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
alert(posx+","+posy);
}
</script>
</head>
<body>
<input name="test" type="button" value="click me" onClick="test();"/>
</body>
</html>
Can anyone help me? I really need the Javascript Framework and the mousepos function working.
Comment