xiuying 发表于 2013-2-7 15:11:57

根据分辨率让window.open的窗口居中

var   popwin;
 if(screen.width=="640")  
   {  
   popwin =  window.open("s1.html","name","resizable=yes,scrollbars=no,menubar=no,toolbar=no,width=450,height=400");
   }  
   else   if(screen.width=="800")  
   {  
     popwin =  window.open("s1.html","name","resizable=yes,scrollbars=no,menubar=no,toolbar=no,width=450,height=400");
   }  
   else   if(screen.width=="1024")  
   {  
     popwin =  window.open("s1.html","name","resizable=yes,scrollbars=no,menubar=no,toolbar=no,width=450,height=400");
   }  
 //重新设置窗口大小
 popwin.resizeTo("550","500");
 //网页正文全文宽
 pw = popwin.document.documentElement.scrollWidth-4;
 //网页正文全文高
 ph =  popwin.document.documentElement.scrollHeight-4;
 //移动窗口到中心位置
 popwin.moveTo((screen.width-pw)/2,(screen.height-ph)/2);
页: [1]
查看完整版本: 根据分辨率让window.open的窗口居中