js中弹出各种窗口方法

//在屏幕中央弹出新窗口 function openNewWindow(width,height,url){     var startW = (screen.availWidth - width)/2;     var startH = (screen.availHeight - height)/2;     window.open(url,"_blank","left="+startW+",top="+startH+",height="+height+",width="+width+",status=no,resizable=1,scrollbars=yes,toolbar=no,menubar=no,location=no"); }

//在屏幕中央弹出打开Word的新窗口 function openWordWindow(url){     var width=800;     var height=600;     var startW = (screen.availWidth - width)/2;     var startH = (screen.availHeight - height)/2;     window.open(url,"_blank","left="+startW+",top="+startH+",height="+height+",width="+width+",status=no,resizable=1,scrollbars=yes,toolbar=no,menubar=yes,location=no"); }

//在屏幕中央弹出新窗口

function openNewWindowByMenu(width,height,url){     var startW = (screen.availWidth - width)/2;     var startH = (screen.availHeight - height)/2;    

window.open(url,"_blank","left="+startW+",top="+startH+",height="+height+",width="+width+",status=yes,resizable=1,scrollbars=yes,toolbar=yes,menubar=yes,l

ocation=no"); }

//弹出全屏窗口

function openNewWindowByMenu(url){     window.open(url,"_blank","left=0,top=0,height="+screen.availHeight+",width="+screen.availWidth+",status=yes,resizable=1,scrollbars=yes,toolbar=yes,

menubar=yes,location=no"); }

//在屏幕中央弹出模态窗口 function openModelWindow(width,height,url){     var d = new Date;     if(url.lastIndexOf("?")==-1){       

  url = url+"?currTime="+d.getTime();     }else{         url = url+"&currTime="+d.getTime();     }     window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:Yes;Help:No;Resizable:No;Scroll:auto;Status:no;");  

  }

//在屏幕中央弹出模态窗口

function openNewModelWindow(width,height,url,Resizable){     var d = new Date;   

  if(url.lastIndexOf("?")==-1){         url = url+"?currTime="+d.getTime();   

  }else{     

    url = url+"&currTime="+d.getTime();    

}    

window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:Yes;Help:No;Resizable:yes;Scroll:auto;Status:no;");   

}

//处理url,在后面自动加上当前当前时间 function dealUrl(url){    

var d = new Date;     if(url.lastIndexOf("?")==-1)

{         url = url+"?currTime="+d.getTime();

  }else{    

     url = url+"&currTime="+d.getTime();  

   }     return url; }

//在屏幕中央弹出可拖动、可滚动窗口

function openAbleWindow(width,height,url){

    var d = new Date;  

   if(url.lastIndexOf("?")==-1){   

      url = url+"?currTime="+d.getTime();     }

else{        

url = url+"&currTime="+d.getTime();   

  }    

window.showModalDialog(url,window,"dialogHeight:"+height+"px;dialogWidth:"+width+"px;center:Yes;Help:No;Resizable:Yes;Scroll:Yes;Status:no;");    }

//在屏幕中央弹出公共的查询模态窗口

function openCommonQueryModelWindow(url)

{    

openModelWindow(600,350,url);

}

原文地址:https://www.cnblogs.com/yclnet/p/3237554.html