function getText(m){
var strings = [];
getString(m, strings);
return strings.join(" ");
function getString(m, strings){
if(m.nodeType == 3){
strings.push(m.data);
}else if(m.nodeType == 1){
for(t = m.firstChild; t != null; t = t.nextSibling){
getString(t, strings);
}
}
}
}<body onload="getText(${body });" >
This is a <i>simple</i> example.</body>
var strings = [];
getString(m, strings);
return strings.join(" ");
function getString(m, strings){
if(m.nodeType == 3){
strings.push(m.data);
}else if(m.nodeType == 1){
for(t = m.firstChild; t != null; t = t.nextSibling){
getString(t, strings);
}
}
}
}<body onload="getText(${body });" >
This is a <i>simple</i> example.</body>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货