JS设置打开网页默认最大化

乱编乱写 3398 Views 0 Comments

方法一:

<script language="javascript">
self.moveto(0,0)
self.resizeto(screen.availwidth,screen.availheight)
</script>

方法二:
将以下代码放在<head></head>之间:

<script language=″javascript″> 
<!--function winfix() { 
if (document.layers) { 
width=screen.availWidth-10; 
height=screen.availHeight-20; 
} else { 
var width=screen.availWidth-2; 
var height=screen.availHeight; 
} 
self.resizeTo(width, height); 
self.moveTo(0, 0); 
} 
//--> 
</script>
将以下代码放在<body>Tag里:
<body onload="winfix()">
方法三:
<script language="javascript"> 
self.moveTo(0,0) 
self.resizeTo(screen.availWidth,screen.availHeight) 
</script> 
<OBJECT id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377- 
00aa003b7a11"> 
<PARAM name="Command" value="Maximize"></OBJECT> 
<BODY onload="if(document.body.offsetWidth<screen.width)max.Click()">>

方法四:
代码如下:

<SCRIPT> 
var mywidth 
if (navigator.appName.indexOf('Netscape') != -1) { 
mywidth=parseInt(window.outerWidth)-28; 
//alert("ns") 
} 
else{ 
if (navigator.appName.indexOf('Microsoft') != -1) { 
mywidth=document.body.clientWidth; 
//alert("ie") 
} 
} 
var ScreenOffset; 
if (mywidth <= 778) { 
//alert("1") 
}else{ 
ScreenOffset = parseInt((mywidth - 778)/2); 
ScreenOffset = 0; 
// alert("2") 
} 
fwLoadMenus(); 
window.onresize = function (){ 
if (navigator.appName.indexOf('Netscape') != -1) { 
mywidth=parseInt(window.outerWidth)-28; 
if(self.screenLeft>0){ 
maximize.Click(); 
} 
} 
else{ 
if (navigator.appName.indexOf('Microsoft') != -1) { 
mywidth=document.body.clientWidth; 
if(self.screenLeft>0){ 
maximize.Click(); 
} 
} 
} 
} 
function ChangeLocation(){ 
var size = screen.width; 
if(size!="1024"){ 
document.location="index_800_600.aspx"; 
} 
} 
</SCRIPT>

标签: 代码, JS,

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
loading