Posted in Javascript onAugust 22, 2012
代码1:最常用的代码,比较简单
<script language="javascript"> self.moveto(0,0) self.resizeto(screen.availwidth,screen.availheight) </script>
代码2:
以下代码放在<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()″>
代码3:
代码如下:
<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()">>
代码4:
<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代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@