`

三段比较实用的js代码

阅读更多

//判断是否是IE
function isIE(){
 if (navigator.appName!="Microsoft Internet Explorer") {return false}
 return true
}


//运行代码
function runEx(cod1)  {
  cod=document.getElementById(cod1)
   var code=cod.value;
   if (code!=""){
    var newwin=window.open('','',''); 
    newwin.opener = null
    newwin.document.write(code); 
    newwin.document.close();
 }
}


//复制代码
function doCopy(ID) {
 if (document.all){
   textRange = document.getElementById(ID).createTextRange();
   textRange.execCommand("Copy");
 }
 else{
   alert("此功能只能在IE上有效")
 }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics