原网页中用的是innertext,脚本之家这里给替换成了innerhtml是为了简单的支持firefox,因为firefox不支持innertext,但已经有办法让firefox支持innertext了,兼容代码如下。
复制代码 代码如下:
//让mozilla支持innertext
try{
htmlelement.prototype.__definegetter__
(
innertext,
function ()
{
var anystring = ;
var childs = this.childnodes;
for(var i=0; i{
if(childs[i].nodetype==1)
anystring += childs[i].tagname==br ? '\n' : childs[i].innertext;
else if(childs[i].nodetype==3)
anystring += childs[i].nodevalue;
}
return anystring;
}
);
}
catch(e){}
以下使用innerhtml实现的代码,其它更多的地方,大家自行测试因时间关系,不多说了。
数据载入中......
[ctrl+a 全选 注:如需引入外部js需刷新才能执行]