/* Code
This code opens a blank window in fullscreen mode, and then uses window. resize to change its size.
Finally, the url is changed by writing onload = "location. replace = 'url.
A window with a FRAME is opened, and a FRAME webpage with a height of 22 is displayed at the top of the window.
This webpage is used to manipulate window movement and close.
*/
/* Description
The Code consists of five HTML files and four image files.
The first part is used to open a window. It doesn't matter which file to store it.
The second part is used to control the movement and closure of the window, which must be placed in the specified file.
In this Code, the five html files are:
1. html; the first part of the code
Load.html; the window opened is a framework webpage.
Chromelesstit.html; Part 1 of code
Contacting.html; used to display webpages with temporary information such as 'page LOADING ..."
Main.html; real main webpage
The four images are
X_a.gif; active
X_d.gif; mouseDown
X_o.gif; mouseOver
The preceding three files indicate different statuses of the Close Window icon.
None.gif; used to cover chromelesstit.html
*/
/* Usage
If you want to open a borderless window like main.html for a file such as 1.html.
Put the first part of the code in this file.
Then connect
<A herf = "main.html">
Change
<A herf = "#" onclick = "doOpen ()">
In the directory where the file is located
1. Create
Chromelesstit.html;
Contacting.html;
Load.html;
For the HTML code of the three files, see the appendix of this article. (Do not make any changes)
2. Create
A directory named images (case sensitive, not required if any)
Http // lain.oso.com.cn/x_a.gif;
Http // lain.oso.com.cn/x_d.gif;
Http // lain.oso.com.cn/x_o.gif;
Http // lain.oso.com.cn/none.gif;
The four files are merged into the directory.
For beginners, the above is enough. If you want better results, change the code by yourself.
*/
<! -- // The first part of the code.
Function doOpen (){
Theurl = "main.html ";
Wname = "name ";
W = 750;
H = 400;
/* Parameter description:
Theurl = "main.html"; the URL to open the window
Wname = "name"; name attribute of the window opened
W = 750; the window width
H = 400; the window height
*/
Open (theurl, wname, w, h );
};
Function open (theURL, wname, W, H ){
Var windowW = W; // determine the webpage width
Var windowH = H; // determine the webpage height
Var windowX = Math. ceil (window. screen. width-windowW)/2 );
Var windowY = Math. ceil (window. screen. height-windowH)/2); // determine the coordinates of the webpage.
If (navigator. appName = "Microsoft Internet Explorer" & parseInt (navigator. appVersion)> = 4) isie = true; else isie = false;
S = ", width =" + W + ", height =" + H;
If (isie = false) {// added support for the Nescape series browsers
SplashWin = window. open ("main.html", wname, "fullscreen = 1, toolbar = 0, location = 0, directories = 0, status = 0, menubar = 0, scrollbars = 0, resizable = 0 "+ s)
SplashWin. resizeTo (Math. ceil (W), Math. ceil (H ))
SplashWin. moveTo (Math. ceil (windowX), Math. ceil (windowY ))
} Else {
SplashWin = window. open ("", wname, "fullscreen = 1, toolbar = 0, location = 0, directories = 0, status = 0, menubar = 0, scrollbars = 0, resizable = 0 "+ s)
SplashWin. resizeTo (Math. ceil (W), Math. ceil (H ))
SplashWin. moveTo (Math. ceil (windowX), Math. ceil (windowY ))
SplashWin.doc ument. open ("text/html", "replace ");
SplashWin.doc ument. write ("SplashWin.doc ument. write ("body {border: 1px solid #000000; overflow: hidden; margin: 0pt ;}");
SplashWin.doc ument. write ("# stillloadingDiv {position: absolute; left: 0px; top: 0px; width: 100% px; height: 19px; z-index: 1; background-color: # C0C0C0; layer-background-color: # C0C0C0; clip: rect (0,100% );}");
SplashWin.doc ument. write ("</style> \ n ");
SplashWin.doc ument. write ("<body onload = \" top.document.location.replace('load.html ") \" TOPMARGIN = 0 LEFTMARGIN = 0 MARGINWIDTH = 0 MARGINHEIGHT = 0 scroll = 'no'> ");
SplashWin.doc ument. write ("<div id = stillloadingDiv> <table width = 100% height = 22 cellspacing = 0 cellpadding = 0> <tr> <td align = left valign = middle width = 100%> <FONT size = 1 face = verdana color = #000000> System energizing... </font> </td> </tr> </table> </div> ");
SplashWin.doc ument. write ("</body> SplashWin.doc ument. close ();
}
SplashWin. focus (); // the first part of the code is complete.
} // -->
Chromelesstit.html File Code
<Html> <Meta http-equiv = Content-Type content = text/html; charset = windows-1252>
<Style type = text/css>
# MywindowTITLE {position: absolute; left: 0px; top: 0px; width: 100%; height: 22px; z-index: 1; background-color: # ffffff; clip: rect (0,100% );}
# Mywindow {position: absolute; left: 0px; top: 0px; width: 100%; height: 22px; z-index: 2; clip: rect (0,100% );}
# MywindowCLOSE {position: absolute; left:-22px; top:-22px; width: 11px; height: 11px; z-index: 3; clip: rect (0, 11, 11,0 );}
</Style>
<Script language = javascript type = text/javascript>
// Chromeless window v1.1 (TITLE)
//////////////////////////////////////// /// // Title bar control //////
Var isinit = false;
Var mywindowok = true;
TheURL = "main.html"
WindowCERRARa = "images/x_a.gif"
WindowCERRARd = "images/x_d.gif"
WindowCERRARo = "images/x_o.gif"
WindowTIT = "<font face = Arial size = 1> Title </font>"
WindowBORDERCOLOR = "#000000"
WindowBORDERCOLORsel = "# FF8A00"
WindowTITBGCOLOR = "# d7dcd9"
WindowTITBGCOLORsel = "# ffffff"
Var windowCERRARImg_a = new Image (); windowCERRARImg_a.src = windowCERRARa;
Var windowCERRARImg_d = new Image (); windowCERRARImg_d.src = windowCERRARd;
Var windowCERRARImg_o = new Image (); windowCERRARImg_o.src = windowCERRARo;
Function whaitborders (){
If (parent. chromewinb & parent. chromewinl & parent. chromewinr ){
Parent.chromewinb.doc ument. bgColor = windowBORDERCOLOR
Parent.chromewinl.doc ument. bgColor = windowBORDERCOLOR
Parent.chromewinr.doc ument. bgColor = windowBORDERCOLOR
} Else {
SetTimeout ('whaitborders () ', 100 );
}
}
Whaitborders ()
//////////////////////////////////////// /// // Mouse move //////
Function mouseSTATUS (){
This. x = null;
This. y = null;
This. bt = "up ";
This. oldx = null;
This. oldy = null;
This. dx = null;
This. dy = null;
This. screeny = null;
This. screenx = null;
This. element = null;
This. event = null;
}
Var mouse = new mouseSTATUS ();
Function actualizateMouseSTATUS (e ){
If (! E) var e = event
If (e. type = "mousedown" | e. type = "mouseup") & e. button! = 1) return true
Var x = e. x + document. body. scrollLeft
Var y = e. y + document. body. scrollTop
Mouse. x = x;
Mouse. y = y;
If (e. type = "mousedown") mouse. bt = "down ";
Else if (e. type = "mouseup") mouse. bt = "up ";
If (window. event ){
Mouse. screenx = window. event. screenX;
Mouse. screeny = window. event. screenY;
} Else {
Mouse. screenx =-1;
Mouse. screeny =-1;
}
}
Function initMouseEvents (){
Document. onmousedown = actualizateMouseSTATUS
Document. onmousemove = actualizateMouseSTATUS
Document. onmouseup = actualizateMouseSTATUS
Document. onselectstart = selectstart
Document. ondragstart = new Function ("actualizateMouseSTATUS (event); return false ;")
}
Function selectstart (){
If (event. srcElement. tagName! = "INPUT" & event. srcElement. tagName! = "TEXTAREA") {return false ;}
Else {mouse. bt = "up"; return true ;}
}
InitMouseEvents ()
//////////////////////////////////////// /// // Window drag //////
Var mywindowbt = "up ";
Var wincloseSTATUS = "up ";
Var ofx = 0;
Var ofy = 0;
Var opx = 0;
Var opy = 0;
Var px = 0;
Var py = 0;
Var wcpx1 =-1, wcpy1 =-1;
Var wcpx2 =-1, wcpy2 =-1;
Var wclosechanged = false;
Function initToMoveWin (){
If (mywindowok ){
If (wincloseSTATUS = "up" & (mywindowbt = "up" | mywindowbt = "over ")){
If (isinit ){
Wcpx1 = document. all ["mywindowCLOSE"]. style. pixelLeft = document. body. clientWidth-18
Wcpy1 = document. all ["mywindowCLOSE"]. style. pixelTop = 4
Wcpx2 = wcpx1 + 11-1
Wcpy2 = wcpy1 + 11-1
If (mouse. x> = wcpx1 & mouse. x <= wcpx2 & mouse. y> = wcpy1 & mouse. y <= wcpy2 ){
If (wclosechanged = false ){
Document. all ["mywindowCLOSE" 2.16.doc ument. images ["closewin"]. src = windowCERRARImg_o.src
Wclosechanged = true
}
} Else if (wclosechanged = true ){
Document. all ["mywindowCLOSE" 2.16.doc ument. images ["closewin"]. src = windowCERRARImg_d.src
Wclosechanged = false
}
}
}
If (mouse. y <= 22 & mouse. y> = 1 & mywindowbt = "up" & mouse. bt = "up") {mywindowbt = "over "}
Else if (mouse. y> 22 | mouse. y <1) & mywindowbt = "over" & mouse. bt = "up") {mywindowbt = "up "}
Else if (mouse. y <= 22 & mouse. y> = 1 & mywindowbt = "over" & mouse. bt = "down "){
Self. window. focus ();
If (mouse. x> = wcpx1 & mouse. x <= wcpx2 & mouse. y> = wcpy1 & mouse. y <= wcpy2 ){
WincloseSTATUS = "down"
Document. all ["mywindowCLOSE" 2.16.doc ument. images ["closewin"]. src = windowCERRARImg_a.src
} Else {
Document. all ["mywindowTITLE"]. style. backgroundColor = windowTITBGCOLORsel
Document. body. style. borderColor = windowBORDERCOLORsel
Parent.chromewinb.doc ument. bgColor = windowBORDERCOLORsel
Parent.chromewinl.doc ument. bgColor = windowBORDERCOLORsel
Parent.chromewinr.doc ument. bgColor = windowBORDERCOLORsel
Ofx = mouse. x;
Ofy = mouse. y;
Opx = mouse. x;
Opy = mouse. y;
}
Mywindowbt = "down ";
}
Else if (mouse. bt = "up" & mywindowbt = "down "){
Mywindowbt = "up ";
Ofx = 0;
Ofy = 0;
Opx = 0;
Opy = 0;
If (mouse. x> = wcpx1 & mouse. x <= wcpx2 & mouse. y> = wcpy1 & mouse. y <= wcpy2 & wincloseSTATUS = "down") {top. window. close ()}
WincloseSTATUS = "up"
If (document. all ["mywindowTITLE"]) {
Document. all ["mywindowTITLE"]. style. backgroundColor = windowTITBGCOLOR
Document. body. style. borderColor = windowBORDERCOLOR
Parent.chromewinb.doc ument. bgColor = windowBORDERCOLOR
Parent.chromewinl.doc ument. bgColor = windowBORDERCOLOR
Parent.chromewinr.doc ument. bgColor = windowBORDERCOLOR
}
}
Else if (mywindowbt = "down" & wincloseSTATUS = "up "){
Var m_scrx = mouse. screenx;
Var m_scry = mouse. screeny;
Opx = px + ofx-m_scrx;
Opy = py + ofy-m_scry;
Px = m_scrx-ofx;
Py = m_scry-ofy;
Top. window. moveTo (px, py );
}
}
SetTimeout ('inittomovewin () ', 20 );
}
InitToMoveWin ()
//////////////////////////////////////// /// // Write title //////
Function init (){
Document. all ["mywindowTITLE"]. innerHTML = '<table width = 100% height = 20 border = 0 cellpadding = 0 cellspacing = 0> <tr> <td valign = middle align = left>' + windowTIT + '</ td> </tr> </table>'
Document. all ["mywindowTITLE"]. style. backgroundColor = windowTITBGCOLOR
Document. all ["mywindowCLOSE" 2.16.doc ument. images ["closewin"]. src = windowCERRARImg_d.src
SetTimeout ('parent. main. location. replace ("'+ theURL +'") ', 200)
Isinit = true
}
</Script> <Body onload = init () TOPMARGIN = 0 LEFTMARGIN = 0 MARGINWIDTH = 0 MARGINHEIGHT = 0 scroll = no style = "border: 1px solid #000000; overflow: hidden; margin: 0pt; "bgcolor = # ffffff>
<Div id = mywindow>
</Div>
<Div id = mywindowTITLE>
</Div>
<Div id = mywindowCLOSE>
</Div>
</Body>
</Html>
Contacting.html File Code
<Html>
<Head>
<Style type = 'text/css '>
Body {border: 0px; overflow: hidden; margin: 0pt ;}
# StillloadingDiv {position: absolute; left: 0px; top: 0px; width: 100%; height: 19px; z-index: 1; background-color: # C0C0C0; layer-background-color: # C0C0C0; clip: rect (0,100% );}
</Style>
</Head>
<Body TOPMARGIN = 0 LEFTMARGIN = 0 MARGINWIDTH = 0 MARGINHEIGHT = 0 scroll = 'no'>
<Div id = stillloadingDiv> <table width = 100% height = 22 cellspacing = 0 cellpadding = 0> <tr> <td align = left valign = middle width = 100%> <FONT size = 1 face = verdana color =# 000000> loading, please wait... </font> </td> </tr> </table> </div>
</Body>
</Html>
Laod.html File Code
<HTML>
<HEAD>
<TITLE> of kai </TITLE>
</HEAD>
<Frameset border = 0 framespacing = 0 frameborder = 0 rows = "22,100%, 1">
<Frame name = chromewint src = "chromelesstit.html" scrolling = no noresize>
<Frameset border = 0 framespacing = 0 frameborder = 0 cols = "1,100%, 1">
<Frame name = chromewinl src = "about: blank" scrolling = no noresize>
<Frame name = main src = "contacting.html" scrolling = "no" noresize>
<Frame name = chromewinr src = "about: blank" scrolling = no noresize>
</Frameset>
<Frame name = chromewinb src = "about: blank" scrolling = no noresize>
<Noframes>
</Noframes>
</Frameset>
<Frameset>
</Frameset>
</HTML>
[This article is copyrighted by the author and osuo. If you need to reprint it, please indicate the author and its source]