删除Netscape中图像的默认拖动行为 [英] Removes default drag behaviour on image in Netscape
问题描述
我正在尝试实施橡皮筋/图像选择脚本。对于
,我需要删除图像上的默认拖动行为。我是
能够在IE中执行此操作但不能在Netscape中执行此操作。有没有人有解决方案?
请看下面的IE代码:
var moz =((document.all)?false: true);
var ie =((document.all)?true:false);
var ElementUtil = new Object();
ElementUtil.addEventListener = function(o,type,handler){
if(ie){
o.attachEvent(" on" + type,handler);
}
else if(moz){
o.addEventListener(type,handler,false);
} < br $>
}
//删除图像上的默认拖动行为即
ElementUtil.addEventListener(img,drag,函数(){return false;});
提前致谢
Kiran Makam
I am trying to implement a rubber band/image selection script. For
that I need to remove the default drag behaviour on an image. I am
able to do this in IE but not Netscape. Does any one have a solution?
Pls look below for IE code:
var moz = ((document.all)? false : true);
var ie = ((document.all)? true : false);
var ElementUtil = new Object();
ElementUtil.addEventListener = function(o, type, handler) {
if(ie) {
o.attachEvent("on" + type, handler);
}
else if(moz) {
o.addEventListener(type, handler, false);
}
}
// Removes default drag behaviour on image in ie
ElementUtil.addEventListener(img, "drag", function() {return false;});
Thanks in advance
Kiran Makam
推荐答案
kiran写道:
kiran wrote:
我正在尝试实施橡皮筋/图像选择脚本。对于
我需要删除图像上的默认拖动行为。我能够在IE中做到这一点,但不能在Netscape中做到这一点。
I am trying to implement a rubber band/image selection script. For
that I need to remove the default drag behaviour on an image. I am
able to do this in IE but not Netscape.
< img onmousedown =" if(event.preventDefault){
event.preventDefault();
}
返回false;"
-
Martin Honnen
http://JavaScript.FAQTs.com /
Martin Honnen< ma ******* @ yahoo.de>在留言新闻中写道:< 41 ********************** @ newsread2.arcor-online.net> ...
Martin Honnen <ma*******@yahoo.de> wrote in message news:<41**********************@newsread2.arcor-online.net>...
< img onmousedown =" if(event.preventDefault){
event.preventDefault();
}
返回false;"
<img onmousedown="if (event.preventDefault) {
event.preventDefault();
}
return false;"
感谢Martin,这正是我想要的。有没有
的网站,我们可以参考Netscape的对象模型(属性,
方法,事件......)?
Kiran Makam
Thanks Martin, this is exactly what I was looking for. Is there any
website where we can refer Netscape''s object model (properties,
methods, events...)?
Kiran Makam
kiran写道:
kiran wrote:
[...]有没有我们可以参考Netscape的网站'对象
模型(属性,方法,事件......)?
[...] Is there any website where we can refer Netscape''s object
model (properties, methods, events...)?
这取决于你对Netscape的意思。对于基于Gecko的UAs,例如Netscape 6+,请参阅
< http://mozilla.org/docs/dom/domref/> <对于所有Netscape版本和基于Gecko的UA(即DOM级别0),
< http://xulplanet.com/references/objref/>
),
见
< http://web.archive.org/web/20031202201701/devedge.netscape.com/central/javascript/> ;
有关一般信息,请参阅
< http://pointedears.de/ObjectInspector>
PointedEars
-
你知道当你靠在椅子上时的感觉,而且你是
That depends on what you mean by Netscape. For Gecko-based UAs like
Netscape 6+, see
<http://mozilla.org/docs/dom/domref/>
<http://xulplanet.com/references/objref/>
For all Netscape versions and Gecko-based UAs (i.e. for DOM Level 0),
see
<http://web.archive.org/web/20031202201701/devedge.netscape.com/central/javascript/>
For general information see
<http://pointedears.de/ObjectInspector>
PointedEars
--
You know that feeling when you''re leaning back in a chair, and you''re
这篇关于删除Netscape中图像的默认拖动行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!