Как мне заставить двигаться изображение по классу а не по айди?
<html>
<head>
<title>HTML-документ</title>
</head>
<script language="JavaScript" type="text/javascript">
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init() {
if (ns4) {document.captureEvents(Event.onmousemove);}
document.onmousemove=mousemove;
}
function mousemove(event) {
var mouse_x = y = 0;
if (document.attachEvent != null) {
mouse_x = window.event.clientX;
mouse_y = window.event.clientY;
} else if (!document.attachEvent && document.addEventListener) {
mouse_x = event.clientX;
mouse_y = event.clientY;
}
status="x = " + mouse_x + ", y = " + mouse_y;
document.getElementById('xy').innerHTML = "x = " + mouse_x + ", y = " + mouse_y;
document.getElementById('x1').style.left = mouse_x;
document.getElementById('x1').style.top = mouse_y;
}
init()
</script>
<body >
<i>Internet</i>
<span id="xy"></span>
<br>
<div id="x1" style="position:absolute;width:50%;height:50%;">
<img src="1.JPG" width="189">
<img src="2.JPG" width="189">
</div>
</body>
</html>