彈出無(wú)邊窗口,彈出無(wú)邊窗口
<html>
<head>
<script language=javascript>
minimizebar=minimize.gif; //窗口右上角最小化“按鈕”地圖片
minimizebar2=minimize2.gif; //鼠標(biāo)懸停時(shí)最小化“按鈕”地圖片
closebar=close.gif; //窗口右上角關(guān)閉“按鈕”地圖片
closebar2=close2.gif; //鼠標(biāo)懸停時(shí)關(guān)閉“按鈕”地圖片
icon=icon.gif; //窗口左上角地小圖標(biāo)
function noborderwin(filename,w,h,titlebg,movebg,titlecolor,titleword,scr) //定義一個(gè)彈出無(wú)邊窗口地函數(shù),能數(shù)意義見(jiàn)下面“參數(shù)說(shuō)明”,實(shí)際使用見(jiàn)最后地實(shí)例.
/*
------------------參數(shù)說(shuō)明-------------------
filename :無(wú)邊窗口中顯示地文件.
w :窗口地寬度.
h :窗口地高度.
titlebg :窗口“標(biāo)題欄”地背景色以及窗口邊框顏色.
movebg :窗口拖動(dòng)時(shí)“標(biāo)題欄”地背景色以及窗口邊框顏色.
titlecolor :窗口“標(biāo)題欄”文字地顏色.
titleword :窗口“標(biāo)題欄”地文字.
scr :是否出現(xiàn)滾動(dòng)條.取值yes/no或者1/0.
--------------------------------------------
*/
{
var contents=<html>+
<head>+
<title>+titleword+</title>+
<meta http-equiv=\content-type\ content=\text/html; charset=gb2312\>+
<object id=hhctrl type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'><param name='command' value='minimize'></object>+
</head>+
<body topmargin=0 leftmargin=0 scroll=no onselectstart='return false' ondragstart='return false'>+
<table height=100% width=100% cellpadding=0 cellspacing=1 bgcolor=+titlebg+ id=maintab>+
<tr height=18 style=cursor:default; onmousedown='x=event.x;y=event.y;setcapture();maintab.bgcolor=\+movebg+\;' onmouseup='releasecapture();maintab.bgcolor=\+titlebg+\;' onmousemove='if(event.button==1)self.moveto(screenleft+event.x-x,screentop+event.y-y);'>+
<td width=18 align=center><img height=12 width=12 border=0 src=+icon+></td>+
<td width=+w+><span style=font-size:12px;color:+titlecolor+;font-family:宋體;position:relative;top:1px;>+titleword+</span></td>+
<td width=14><img border=0 width=12 height=12 alt=最小化 src=+minimizebar+ onmousedown=hhctrl.click(); onmouseover=this.src='+minimizebar2+' onmouseout=this.src='+minimizebar+'></td>+
<td width=13><img border=0 width=12 height=12 alt=關(guān)閉 src=+closebar+ onmousedown=self.close(); onmouseover=this.src='+closebar2+' onmouseout=this.src='+closebar+'></td>+
</tr>+
<tr height=*>+
<td colspan=4>+
<iframe name=nbw_v6_iframe src=+filename+ scrolling=+scr+ width=100% height=100% frameborder=0></iframe>+
</td>+
</tr>+
</table>+
</body>+
</html>;
pop=window.open(,_blank,fullscreen=yes);
pop.resizeto(w,h);
pop.moveto((screen.width-w)/2,(screen.height-h)/2);
pop.document.writeln(contents);
if(pop.document.body.clientwidth!=w||pop.document.body.clientheight!=h) //如果無(wú)邊窗口不是出現(xiàn)在純粹地ie窗口中
{
temp=window.open(,nbw_v6);
temp.close();
window.showmodaldialog(about:<+script language=javascript>window.open('','nbw_v6','fullscreen=yes');window.close();+</+script>,,dialogwidth:0px;dialogheight:0px);
pop2=window.open(,nbw_v6);
pop2.resizeto(w,h);
pop2.moveto((screen.width-w)/2,(screen.height-h)/2);
pop2.document.writeln(contents);
pop.close();
}
}
</script>
</head>
<body>
<!----------------- 實(shí)例一(按鈕),修改參數(shù)可改變窗口樣式 ----------------->
<button onclick=noborderwin('test.html','400','240','#000000','#333333','#cccccc','一個(gè)無(wú)邊窗口地測(cè)試?yán)?,'yes');>open</button>
<br><br>
<!----------------- 實(shí)例二(鏈接),修改參數(shù)可改變窗口樣式 ----------------->
<a href=#none onclick=noborderwin('test.html','400','240','#000000','#333333','#cccccc','一個(gè)無(wú)邊窗口地測(cè)試?yán)?,'yes');>open</a>
<br><br>
<!----------------- 實(shí)例三(圖片),修改參數(shù)可改變窗口樣式 ----------------->
<img src=none height=30 width=60 alt=open style=cursor:hand onclick=noborderwin('test.html','400','240','#000000','#333333','#cccccc','一個(gè)無(wú)邊窗口地測(cè)試?yán)?,'no');>無(wú)滾動(dòng)條地
</body>
</html>
更多信息請(qǐng)查看IT技術(shù)專欄