在mousemove上调用函数 [英] Call function on mousemove

查看:104
本文介绍了在mousemove上调用函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个java Script函数,我想在鼠标移动时调用它,所以在java脚本中调用它的方式是什么。
谢谢

I have a java Script function that i want to call whenever mouse moves so whats the way to call it in java script. Thanks

推荐答案

嗯,你并没有真正提供你要附加处理程序的元素,但是以下是使用body元素的方法:

Well, you didn't really provide an element onto which you want to attach the handler, but here's how to do it with the body element:

<html>
<head>
<script type="text/javascript">
function move() {
alert("Your mouse moved!");
}
</script>
</head>
<body onmousemove="move()">
<div>Test</div>
</body>
</html>

这篇关于在mousemove上调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆