<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="jquery-1.10.2.min.js"></script>
</head>
<body>
<img id="img" src="./sxx5.png">
</img>
<div id="container">
</div>
</body>
<script>
$(document).ready(function(){
$("#img").mousemove(function(e){
var widthh=e.originalEvent.x-$(this).offset().left||e.originalEvent.layerX-$(this).offset().left||0;//搜索
var heightt=e.originalEvent.y-$(this).offset().top||e.originalEvent.layerY-$(this).offset().top||0;//
$('#container').text("图片的宽度:" + widthh +"<br>图片的高度:"+heightt);
}).mouseout(function(){
$("#tooltip").remove();
this.title = this.myTitle;
})
});
</script>
</html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="jquery-1.10.2.min.js"></script>
</head>
<body>
<img id="img" src="./sxx5.png">
</img>
<div id="container">
</div>
</body>
<script>
$(document).ready(function(){
$("#img").mousemove(function(e){
var widthh=e.originalEvent.x-$(this).offset().left||e.originalEvent.layerX-$(this).offset().left||0;//搜索
var heightt=e.originalEvent.y-$(this).offset().top||e.originalEvent.layerY-$(this).offset().top||0;//
$('#container').text("图片的宽度:" + widthh +"<br>图片的高度:"+heightt);
}).mouseout(function(){
$("#tooltip").remove();
this.title = this.myTitle;
})
});
</script>
</html>