如何在触摸屏iPhone上实现onmousedown和onmouseup [英] How to implement a onmousedown and onmouseup on a touch screen iphone

查看:504
本文介绍了如何在触摸屏iPhone上实现onmousedown和onmouseup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚接触HTML/Java,但是正在学习...

I've very new to HTML/Java but am learning...

我想在iPhone上开发一个按钮,该按钮在按下和释放时会运行Java脚本命令.我已经使用onmousedown和onmouseup属性完成了此查找,但这并不相同.

I want to develop a button on an iphone that runs a java script command when press and when it is released. I've done this find using onmousedown and onmouseup attributes, but this does not work the same.

有人可以为我指出在iPhone上如何执行相同操作的正确方向吗?

could someone please point me in the right direction as to how to do this same thing on the iphone?

推荐答案

触摸屏设备上onmousedown的等效项是ontouchstartonmouseup的等效项是ontouchend.

The equivalent for onmousedown on touchscreen devices is ontouchstart, and the equivalent of onmouseup is ontouchend.

如果您还想检测拖动,则可以使用ontouchmove,它在触摸屏幕后每次移动手指都会触发.

If you would also like to detect dragging, you could use ontouchmove which is fired every time you move your finger after touching the screen.

这篇关于如何在触摸屏iPhone上实现onmousedown和onmouseup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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