//检测页面是否被嵌入 function isMatch(str1,str2){var index = str1.indexOf(str2);if(index==-1) return false;return true;} //初始化JS代码 function initJS(){ ReImgSize() //自动缩放代码 } //加入收藏 function bookmark(anchor){ if(window.external) { window.external.AddFavorite(anchor.getAttribute('href'), anchor.getAttribute('title')); return false; } return true; } //网站导航 function $(id) { return document.getElementById(id); } function showMenu (baseID, divID) { baseID = $(baseID); divID = $(divID); //var l = GetOffsetLeft(baseID); //var t = GetOffsetTop(baseID); //divID.style.left = l + 'px'; // divID.style.top = t + baseID.offsetHeight + 'px'; if (showMenu.timer) clearTimeout(showMenu.timer); hideCur(); divID.style.display = 'block'; showMenu.cur = divID; if (! divID.isCreate) { divID.isCreate = true; //divID.timer = 0; divID.onmouseover = function () { if (showMenu.timer) clearTimeout(showMenu.timer); hideCur(); divID.style.display = 'block'; }; function hide () { showMenu.timer = setTimeout(function () {divID.style.display = 'none';}, 1200); } divID.onmouseout = hide; baseID.onmouseout = hide; } function hideCur () { showMenu.cur && (showMenu.cur.style.display = 'none'); } } //查找网页内宽度太大的图片进行缩放以及PNG纠正 function ReImgSize(){ for (i=0;i1000) { document.images[i].title="在新窗口打开图片" document.images[i].width="1000" try{ document.images[i].outerHTML=''+document.images[i].outerHTML+'' }catch(e){} } } else{ if (document.images[i].width>1000) { document.images[i].title="在新窗口打开图片" document.images[i].style.cursor="pointer" document.images[i].onclick=function(e){window.open(this.src)} } } } } //运行代码 function runCode(obj) { var winname = window.open('', "_blank", ''); winname.document.open('text/html', 'replace'); winname.opener = null // 防止代码对原页面修改 winname.document.write(obj.value); winname.document.close(); } //复制代码 function saveCode(obj) { var winname = window.open('', '_blank', 'top=10000'); winname.document.open('text/html', 'replace'); winname.document.writeln(obj.value); winname.document.execCommand('saveas','','code.html'); winname.close(); } //另存代码 function copyCode(obj) { var rng = document.body.createTextRange(); rng.moveToElementText(obj); rng.scrollIntoView(); rng.select(); rng.execCommand("Copy"); rng.collapse(false); } // 搜索 function CheckGoogleSearchForm() { if (GoogleSearch.q.value==""){ alert("请输入关键字词!") GoogleSearch.q.focus(); return false; } if (GoogleSearch.q.value=="输入关键字词..."){ alert("请输入关键字词!") GoogleSearch.q.focus(); return false; } } //其它