attachEvent ('onmouseover', new Function("Somefuc(someparma);"));
解决方案 »
- 高手们帮忙分析一下吧!js代码浏览器兼容性问题!谢谢了
- IE不能调用本地的js文件
- js得到鼠标选中的字是什么字
- 急,如何对javascript的内容搜索
- []用iframe隐式提交表单的问题:iframe中document无法访问
- 如何防止写在网站内的email被恶意bot抓取?
- IE 下的onpropertychange 在NETSCAPE下用什么呀?
- 能否判断一个下拉框是否改变过
- 求限制textArea最大字符数的函数?例如限制最多只能输入100个字符,输入可能是中文或英文,当输入了99个字符长度,则不能再输入一个汉字,只能
- 这种qq菜单怎么做?欢迎提供源码。效果请看:http://www.widelong.com/bbs/menu.asp
- 高人进来!!分不够狂加,直到解决问题位置 如何检测到Alt+F4,还有就是如何在不同的浏览器里检测关闭事件
- FireFox里怎么让这句话执行
Surely a staple to event attachment! Regardless to what version you use written by whatever developer, it does what it says it does. And of course as you might of known, I’ve put together quite a handy version myself recently of addEvent() with some help from the contest winner and Mark Wubben along with a few minor syntax adjustments. But just to be fair to Scott Andrew, here is the original that started it all.Scott Andrew’s original addEvent() functionfunction addEvent(elm, evType, fn, useCapture) {
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
if (elm.addEventListener) {
elm.addEventListener(evType, fn, useCapture);
return true;
}
else if (elm.attachEvent) {
var r = elm.attachEvent('on' + evType, fn);
return r;
}
else {
elm['on' + evType] = fn;
}
}
用这个兼容性比较好些。