ygz
查看ygz的博客
金钱 | : 1625 |
Level | : 0 |
发帖数 | : 227 |
最后登陆 | : 2019/1/21 |
注册时间 | : 2004/10/6 |
|
新弹出窗口的几种方法 一、新开窗口,指定大小,自动屏幕居中 首先请在<head></head>之间粘贴右边的代码; <script language="javascript"> var win = null; function NewWindow(mypage,myname,w,h,scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' win = window.open(mypage,myname,settings) } </script> 二、新开无边框窗口,指定大小自动屏幕居中 然后在<head></head>之间粘贴右边的代码; <script language="javascript"> function movetocenter(w,h){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; zz=window.open('red.htm','','fullscreen'); zz.resizeTo(w,h); zz.moveTo(LeftPosition,TopPosition); } </script> 三、新开全屏窗口 请继续在<head></head>之间粘贴右边的代码; <script> <!-- function fullwin(targeturl){ window.open(targeturl,"","fullscreen,scrollbars") } //--> </script> 附加说明: 调用方法: 1.<a href="red.htm" onclick="NewWindow(this.href,'opwd','400','300','no','center');return false" onfocus="this.blur()">新开窗口,指定大小,自动屏幕居中</a> 2.<a href="#" onclick="movetocenter(400,400)">新开无边框窗口,指定大小</a> 3.<a href="#" onClick="fullwin('red.htm')">新开全屏窗口</a>
|