2个回答
展开全部
<html>
<head>
<script tpye="text/javascript">
function MoveToMouseEvent()
{
var img = document.getElementById("img1");
alert(img.id+":"+event.x + "::" + event.y);
img.style.left = event.x +"px";
img.style.top = event.y +"px";
}
</script>
</head>
<body >
<input type="text" onclick="MoveToMouseEvent()"/>
<img id="img1" src="" style="width:100px;height:100px;position:absolute;"/>
</body>
</html>
你把img换成picturebox,位置你可以随便指定,这个例子是指定的鼠标出发事件的坐标
<head>
<script tpye="text/javascript">
function MoveToMouseEvent()
{
var img = document.getElementById("img1");
alert(img.id+":"+event.x + "::" + event.y);
img.style.left = event.x +"px";
img.style.top = event.y +"px";
}
</script>
</head>
<body >
<input type="text" onclick="MoveToMouseEvent()"/>
<img id="img1" src="" style="width:100px;height:100px;position:absolute;"/>
</body>
</html>
你把img换成picturebox,位置你可以随便指定,这个例子是指定的鼠标出发事件的坐标
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询