与mozilla等效的ondrag事件 [英] ondrag event equivalent for mozilla

查看:74
本文介绍了与mozilla等效的ondrag事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一些我可以用来阻止用户拖动某些东西的东西,例如一个图像。在IE中我可以使用ondrag =" return

false;",有没有办法与其他浏览器实现相同的方式?


谢谢,


David

Is there something that I can use to prevent the a user from dragging
something, an image for instance. In IE I can use the ondrag = "return
false;", is there a way to achieve the same way with the other browsers?

Thanks,

David

推荐答案




David写道:


David wrote:
我可以使用哪些东西阻止用户拖动某些东西,例如图像。在IE中,我可以使用ondrag =" return
false;",有没有办法与其他浏览器实现相同的方式?
Is there something that I can use to prevent the a user from dragging
something, an image for instance. In IE I can use the ondrag = "return
false;", is there a way to achieve the same way with the other browsers?




< img onmousedown =" if(event.preventDefault){

event.preventDefault();

}

return false;"

src =" whatever.gif" alt =" whatever">

应该这样做。


-


Martin Honnen http://JavaScript.FAQTs.com/


Martin Honnen:
Martin Honnen:

David写道:

David wrote:
有什么东西我可以用来防止用户从拖动某物,例如图像。在IE中,我可以使用ondrag =" return
false;",有没有办法与其他浏览器实现相同的方式?
Is there something that I can use to prevent the a user from dragging
something, an image for instance. In IE I can use the ondrag = "return
false;", is there a way to achieve the same way with the other browsers?



< img onmousedown =" if(event.preventDefault){
event.preventDefault();
}
返回false;"
src =" whatever.gif" alt =" whatever">
应该这样做。

-



<img onmousedown="if (event.preventDefault) {
event.preventDefault();
}
return false;"
src="whatever.gif" alt="whatever">
should do.

--




这个问题是我有img标签嵌套在div标签内

需要点击而不取消活动。还有其他

想法吗?



The problem with this is that I have the img tag nested inside a div tag
which needs to be clicked and not have the event cancelled. Any other
ideas?





David写道:


David wrote:
Martin Honnen:
Martin Honnen:
David写道:
David wrote:
我可以使用哪些东西阻止用户拖动
某事,例如图像。在IE中,我可以使用ondrag =" return
false;",有没有办法与其他浏览器实现相同的方式?
Is there something that I can use to prevent the a user from dragging
something, an image for instance. In IE I can use the ondrag = "return
false;", is there a way to achieve the same way with the other browsers?



< img onmousedown =" if(event.preventDefault){
event.preventDefault();
}
返回false;"
src =" whatever.gif" alt =" whatever">
应该这样做。



<img onmousedown="if (event.preventDefault) {
event.preventDefault();
}
return false;"
src="whatever.gif" alt="whatever">
should do.



这个问题是我将img标签嵌套在div标签中
需要被点击,没有取消活动。还有其他什么想法?



The problem with this is that I have the img tag nested inside a div tag
which needs to be clicked and not have the event cancelled. Any other
ideas?




你仍然可以点击< div>在< img>之外。


-


Martin Honnen
http://JavaScript.FAQTs.com/


这篇关于与mozilla等效的ondrag事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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