常用JS模板

时间:2023-12-14 22:32:02
var _win, _doc, _stt, _do = document.domain, _arr = _do.split(".");
function _st() {
try {
document.domain = _arr.join(".");
_arr.shift();
}catch(e){
document.domain = _do;
_arr = _do.split(".");
_arr.shift();
}
if(document.frames) {
_doc = document.frames["ifrmain"].document;
_win = document.frames["ifrmain"].window;
}else{
_doc = document.getElementById("ifrmain").contentDocument;
_win = document.getElementById("ifrmain").contentWindow;
}
if(_doc && _win && _win.location.href != "about:blank" && (_doc.readyState == "interactive" || _doc.readyState == "complete")) {
if(_stt) clearTimeout(_stt);
//do some init
}else{
_stt = setTimeout(_st, 500);
}
}