<html>
<head>
<title>MaHiii : CSS Tution</title>
<style type="text/css">
div#myDiv1 {
position:absolute;
left:0;
top:0;
}
</style>
</head>
<body>
<div id="myDiv1">MaHiiiiiii</div>
<script type="text/javascript">
var mydiv1=document.getElementById("myDiv1");
document.addEventListener('mousemove', function (e) {
var x = e.pageX;
var y = e.pageY;
mydiv1.style.top = y + 'px';
mydiv1.style.left = x + 'px';
});
</script>
</body>
</html>
Output :)
<head>
<title>MaHiii : CSS Tution</title>
<style type="text/css">
div#myDiv1 {
position:absolute;
left:0;
top:0;
}
</style>
</head>
<body>
<div id="myDiv1">MaHiiiiiii</div>
<script type="text/javascript">
var mydiv1=document.getElementById("myDiv1");
document.addEventListener('mousemove', function (e) {
var x = e.pageX;
var y = e.pageY;
mydiv1.style.top = y + 'px';
mydiv1.style.left = x + 'px';
});
</script>
</body>
</html>
Output :)
No comments:
Post a Comment