<html>
<head>
<title>111</title>
<script type="text/javascript">
function fixEvent(event) {
event = event || window.event
if ( event.isFixed ) {
return event
}
event.isFixed = true
event.preventDefault = event.preventDefault || function(){this.returnValue = false}
event.stopPropagation = event.stopPropagaton || function(){this.cancelBubble = true}
if (!event.target) {
event.target = event.srcElement
}
if (!event.relatedTarget && event.fromElement) {
event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement;
}
if ( event.pageX == null && event.clientX != null ) {
var html = document.documentElement, body = document.body;
event.pageX = event.clientX + (html && html.scrollLeft || body && body.scrollLeft || 0) - (html.clientLeft || 0);
event.pageY = event.clientY + (html && html.scrollTop || body && body.scrollTop || 0) - (html.clientTop || 0);
}
if ( !event.which && event.button ) {
event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) ));
}
return event
}
ffunc = function(event) {
event= fixEvent(event);
var div=document.createElement("div");
div.style.position= "absolute";
div.style.left= event.pageX//clientX;
div.style.top= event.pageY//clientY;
div.style.width=div.style.height="5px";
div.style.overflow="hidden";
div.style.background="yellow";
document.getElementsByTagName("body")[0].appendChild(div);
}
</script>
</head>
<body id="body" style="padding: 0 ; margin: 0 ;" onmousemove="ffunc(event)"></body>
</html>
У меня заработало только после того, как я переписал ffunc с нуля. Хз. Может, div_element - зарезервированное имя?