日期:2014-05-16 浏览次数:20351 次
1.sleep()
function sleep(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } }?
作用是跟setTimeout一样的,都是等待多少毫秒执行。numberMillis表示多少毫秒
?
2.removeHTMLTag()
function removeHTMLTag(str) { str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag str = str.replace(/[ | ]*\n/g,'\n'); //去除行尾空白 str = str.replace(/\n[\s| | ]*\r/g,'\n'); //去除多余空行 str=str.replace(/ /ig,'');//去掉 return str; }?
去除html标签。str为要去掉的字符串