萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> 頁面自動最大化特效JS代碼

頁面自動最大化特效JS代碼

代碼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>

copyright © 萬盛學電腦網 all rights reserved