主頁 > 知識庫 > 無邊框窗口代碼詳解

無邊框窗口代碼詳解

熱門標(biāo)簽:珠海銷售外呼系統(tǒng)運營商 外呼系統(tǒng)啥意思 四川電信外呼系統(tǒng)靠譜嗎 山東智能云外呼管理系統(tǒng) 地圖標(biāo)注創(chuàng)業(yè)項目入駐 地圖標(biāo)注制作道路 電銷外呼系統(tǒng) 排行榜 廣州三五防封電銷卡 長春回?fù)芡夂粝到y(tǒng)廠家
/*代碼思路
此代碼會以fullscreen方式打開一個空白窗口,然后用window.resize改變其大小。
最后在以寫入onload="location.replace='url'"的辦法將網(wǎng)址改變。
打開的窗口會是一個帶有FRAME的窗口,其中窗口頂端會有一個高22的框架網(wǎng)頁。
此網(wǎng)頁是用來操縱窗口移動及關(guān)閉。
*/

/*說明
代碼分兩個部分,但總共牽涉到5個HTML文件及4個圖像文件
第一部分是用來打開窗口,放在哪個文件都無所謂。
第二部分是用來控制窗口的移動及關(guān)閉,必須放在指定的文件里。
在此代碼里,5個html文件分別為:
1.html; 代碼第一部分所在
load.html; 所打開的窗口,是一個框架網(wǎng)頁
chromelesstit.html;代碼第2部分所在
contacting.html;用來顯示如'PAGE LOADING.."等臨時信息的網(wǎng)頁
main.html;真正的主網(wǎng)頁
4個圖像分別為
x_a.gif; active
x_d.gif; mouseDown
x_o.gif; mouseOver
以上三個文件分別代表關(guān)閉窗口圖標(biāo)的不同狀態(tài)
none.gif; 用來遮蓋chromelesstit.html
*/

/*使用方法
如果你想讓一個文件,如1.html,中的某一個連接打開一個指像main.html的無邊框窗口。
把代碼第一部分放到該文件中。
然后將連接
a herf="main.html">
改為
a herf="#" onclick="doOpen()">
在該文件所在目錄內(nèi)
1.建立
chromelesstit.html;
contacting.html;
load.html;
等三個文件,其HTML代碼見本文所附。(不要做任何修改)
2.建立
一個名為images的目錄(注意大小寫,與有則不用),將
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;
這4個文件拷入改目錄.
對于初學(xué)者,以上則足夠了。如果想要更好的效果,自己改代碼。
*/
!--//代碼第一部分。
function doOpen(){
theurl="main.html";
wname ="name";
w=750;
h=400;
/* 參數(shù)說明:
theurl="main.html"; 打開窗口的網(wǎng)址
wname ="name"; 打開窗口的name屬性
w=750; 打開窗口的寬度
h=400; 打開窗口的高度
*/
open(theurl, wname, w, h);
};
function open(theURL, wname, W, H) {
var windowW = W;//確定網(wǎng)頁的寬度
var windowH = H;//確定網(wǎng)頁的高度
var windowX = Math.ceil( (window.screen.width - windowW) / 2 );
var windowY = Math.ceil( (window.screen.height - windowH) / 2 );//確定網(wǎng)頁的坐標(biāo)

if (navigator.appName == "Microsoft Internet Explorer" parseInt(navigator.appVersion)>=4) isie=true; else isie=false;
s = ",width="+W+",height="+H;
if (isie===false){//加入對Nescape系列瀏覽器的支持
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.document.open("text/html", "replace");
splashWin.document.write("html>style type='text/css'>\n");
splashWin.document.write("body{border: 1px solid #000000; overflow: hidden; margin: 0pt;}");
splashWin.document.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%,19,0);}");
splashWin.document.write("/style>\n");
splashWin.document.write("body onload=\&;top.document.location.replace('load.html")\&; TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll='no'>");
splashWin.document.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>nbsp;nbsp;System energizing .../font>/td>/tr>/table>/div>");
splashWin.document.write("/body>/html>");
splashWin.document.close();
}
splashWin.focus();//代碼第一部分完
}//-->



chromelesstit.html 文件代碼

html>head>
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%,22,0); }
#mywindow { position: absolute; left: 0px; top: 0px; width: 100%; height: 22px; z-index: 2; clip:rect(0,100%;22,0); }
#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.document.bgColor=windowBORDERCOLOR
parent.chromewinl.document.bgColor=windowBORDERCOLOR
parent.chromewinr.document.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"].document.images["closewin"].src=windowCERRARImg_o.src
wclosechanged = true
}

}else if (wclosechanged == true){
document.all["mywindowCLOSE"].document.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"].document.images["closewin"].src=windowCERRARImg_a.src
}else{
document.all["mywindowTITLE"].style.backgroundColor = windowTITBGCOLORsel
document.body.style.borderColor = windowBORDERCOLORsel
parent.chromewinb.document.bgColor=windowBORDERCOLORsel
parent.chromewinl.document.bgColor=windowBORDERCOLORsel
parent.chromewinr.document.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.document.bgColor=windowBORDERCOLOR
parent.chromewinl.document.bgColor=windowBORDERCOLOR
parent.chromewinr.document.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"].document.images["closewin"].src=windowCERRARImg_d.src

setTimeout('parent.main.location.replace("'+theURL+'")',200)

isinit=true
}

/script>/head>
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>
img src=images/none.gif width=100% height=20>
/div>
div id=mywindowTITLE>
img width=1 height=1>
/div>
div id=mywindowCLOSE>
img name=closewin src=images/none.gif border=0 width=11 height=11>
/div>
/body>
/html>


contacting.html 文件代碼

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%,19,0);}
/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>nbsp;nbsp;loading, please wait. . ./font>/td>/tr>/table>/div>
/body>
/html>

laod.html 文件代碼

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>


【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請注明作者及出處】    


標(biāo)簽:北海 保定 肇慶 吳忠 紹興 潮州 玉樹 廣元

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《無邊框窗口代碼詳解》,本文關(guān)鍵詞  無,邊框,窗口,代碼,詳解,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《無邊框窗口代碼詳解》相關(guān)的同類信息!
  • 本頁收集關(guān)于無邊框窗口代碼詳解的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章