两个全屏JavaScript代码

可以自定义标题栏,隐藏边框的全屏代码

 1<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
 2
 3<title>
 4Chromeless Window
 5</title>
 6<script language="JScript">
 7/*
 8This following code are designed and writen by Windy_sk <windy_sk @126.com>
 9You can use it freely, but u must held all the copyright items!
10Special Thanks For andot
11*/
12var CW_width = 400;
13var CW_height = 300;
14var CW_top = 100;
15var CW_left = 100;
16var CW_url = "/";
17var New_CW = window.createPopup();
18var CW_Body = New_CW.document.body;
19var content = "";
20var CSStext = "margin:1px;color:black; border:2px outset;border-style:expression(onmouseout=onmouseup=function(){ this.style.borderStyle='outset' }, onmousedown=function(){ if(event.button!=2)this.style.borderStyle='inset' });background-color:buttonface;width:16px;height:14px;font-size:12px;line-height:11px;cursor:Default;";
21
22function insert_content(){ 
23var temp = "";
24CW_Body.style.overflow = "hidden";
25CW_Body.style.backgroundColor = "white";
26CW_Body.style.border = "solid black 1px";
27temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
28temp += "<tr style=';font-size:12px;background:#0099CC;height:20;cursor:default' ondblclick=\"Max.innerText=Max.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" onmouseup='parent.drag_up(event)' onmousemove='parent.drag_move(event)' onmousedown='parent.drag_down(event)' onselectstart='return false' oncontextmenu='return false'>";
29temp += "<td style='color:#ffffff;padding-left:5px'>Chromeless Window For IE6 SP1</td>";
30temp += "<td style='color:#ffffff;padding-right:5px;' align=right>";
31temp += "<span id=Help  onclick=\"alert('Chromeless Window For IE6 SP1  -  Ver 1.0\\n\\nCode By Windy_sk\\n\\nSpecial Thanks For andot')\" style=\""+CSStext+"font-family:System;padding-right:2px;\">?</span>";
32temp += "<span id=Min   onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\" title='Minimum'>0</span>";
33temp += "<span id=Max   onclick=\"this.innerText=this.innerText=='1'?'2':'1';parent.if_max=!parent.if_max;parent.show_CW();\" style=\""+CSStext+"font-family:Webdings;\" title='Maximum'>1</span>";
34temp += "<span id=Close onclick='parent.opener=null;parent.close()' style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>";
35temp += "</td></tr><tr><td colspan=2>";
36temp += "<div>";
37temp += "<object id='include' style='overflow:scroll; HEIGHT: 100%; width:"+CW_width+"';border:0px' type='text/html' data='"+CW_url+"'></object>";
38temp += "</div>";
39temp += "</td></tr></table>";
40CW_Body.innerHTML = temp;
41}
42insert_content();
43
44var if_max = true;
45function show_CW(){ 
46window.moveTo(10000, 10000);
47if(if_max){ 
48New_CW.show(CW_top, CW_left, CW_width, CW_height);
49if(typeof(New_CW.document.all.include)!="undefined"){ 
50New_CW.document.all.include.style.width = CW_width;
51New_CW.document.all.Max.innerText = "1";
52}
53
54}else{ 
55New_CW.show(0, 0, screen.width, screen.height);
56New_CW.document.all.include.style.width = screen.width;
57}
58}
59
60window.onfocus  = show_CW;
61window.onresize = show_CW;
62
63// Move Window
64var drag_x,drag_y,draging=false
65
66function drag_move(e){ 
67if (draging){ 
68New_CW.show(e.screenX-drag_x, e.screenY-drag_y, CW_width, CW_height);
69return false;
70}
71}
72
73function drag_down(e){ 
74if(e.button==2)return;
75if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)return;
76drag_x=e.clientX;
77drag_y=e.clientY;
78draging=true;
79e.srcElement.setCapture();
80}
81
82function drag_up(e){ 
83draging=false;
84e.srcElement.releaseCapture();
85if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return;
86CW_top  = e.screenX-drag_x;
87CW_left = e.screenY-drag_y;
88}
89</script>
90</meta>

普通全屏代码

 1
 2function fullscreen()
 3{ 
 4var Pop;
 5           if (self.screen) { 
 6           sw = screen.width;
 7           sh = screen.height;
 8  w = sw-10; // to center: use desired width
 9  h = sh - 70; // to center: use desired height
10  cx = 0;  // to center: (.5*sw) - (w*.5)
11  cy = 0; // to center: (.5*sh) - (h*.5)
12
13     var  dimentions_and_such = 'width='+w+','+'height='+h+',' + 'screenX=' +cx+','+'screenY='+cy+','+'left='+cx+','+'top='+cy+',toolbar=0,status=0,menubar=0,resizable=0';
14     var  dimentions_and_such1 = 'scrollbars=0,width='+w+','+'height='+h+',' + 'screenX=' +cx+','+'screenY='+cy+','+'left='+cx+','+'top='+cy+',toolbar=0,status=0,fullscreen=0,menubar=0,resizable=0';
15 if (screen.width < 900)
16 { 
17  Pop=window.open("love.htm","","toolbar=0,location=0,fullscreen=1,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
18  }
19 else if (screen.width > 1200)
20 { 
21  Pop=window.open("love.htm","",dimentions_and_such1);
22  }
23 else
24 { 
25
26  Pop=window.open("love.htm","",dimentions_and_such1);
27  }
28}
29
30}
31fullscreen();