适合于IE6 SP1的无边框网页--仍然需要改进,但对于基本应用应该可用了

该博客主要围绕IE6 SP1无边框窗口展开,给出了创建无边框窗口的JScript代码,包含窗口大小、位置、内容等设置。原版代码存在脚本变量溢出问题,修改后的代码虽解决了该问题,但在WinXP下多次点击仍可能出错,还给出了窗口拖动等交互功能的代码。
None.gif<HTML>
None.gif
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
None.gif
<title>Chromeless Window</title>
None.gif
ExpandedBlockStart.gifContractedBlock.gif
<SCRIPT LANGUAGE="JScript">dot.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
/**//*
InBlock.gif This following code are designed and writen by Windy_sk <windy_sk@126.com>
InBlock.gif You can use it freely, but u must held all the copyright items!
InBlock.gif 2003-12-23 modified
InBlock.gif Special Thanks For andot
ExpandedSubBlockEnd.gif
*/

InBlock.gif
InBlock.gif
InBlock.gif
var CW_width    = 400;
InBlock.gif
var CW_height    = 300;
InBlock.gif
var CW_top    = 100;
InBlock.gif
var CW_left    = 100;
InBlock.gif
var CW_url    = "./default.htm";
InBlock.gif
var New_CW    = window.createPopup();
InBlock.gif
var CW_Body    = New_CW.document.body;
InBlock.gif
var content    = "";
InBlock.gif
var 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;";
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function insert_content()dot.gif{
InBlock.gif    
var temp = "";
InBlock.gif    CW_Body.style.overflow        
= "hidden";
InBlock.gif    CW_Body.style.backgroundColor    
= "white";
InBlock.gif    CW_Body.style.border        
= "solid black 1px";
InBlock.gif    temp 
+= "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
InBlock.gif    temp 
+= "<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'>";
InBlock.gif    temp 
+= "<td style='color:#ffffff;padding-left:5px'> 无边框窗口 For IE6 SP1 </td>";
InBlock.gif    temp 
+= "<td style='color:#ffffff;padding-right:5px;' align=right>";
InBlock.gif    temp 
+= "<span id=Help  onclick=\"alert('无边框窗口 For IE6 SP1  -  Ver 1.0\\n\\n Source Code By Windy_sk\\n\\nSpecial Thanks For andot\\n\\n Second Edit by SGSOFT')\" style=\""+CSStext+"font-family:System;padding-right:2px;\">?</span>";
InBlock.gif    temp 
+= "<span id=Min   onclick='parent.New_CW.hide();parent.blur()' style=\""+CSStext+"font-family:Webdings;\" title='Minimum'>0</span>";
InBlock.gif    temp 
+= "<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>";
InBlock.gif    temp 
+= "<span id=Close onclick='parent.opener=null;parent.close()' style=\""+CSStext+"font-family:System;padding-right:2px;\" title='Close'>x</span>";
InBlock.gif    temp 
+= "</td></tr><tr><td colspan=2>";
InBlock.gif    temp 
+= "<div>";
InBlock.gif    temp 
+= "<object id='include' style='overflow:scroll; HEIGHT: 100%; width:"+CW_width+"';border:0px' type='text/html' data='"+CW_url+"'></object>";
InBlock.gif    temp 
+= "</div>";
InBlock.gif    temp 
+= "</td></tr></table>";
InBlock.gif    CW_Body.innerHTML 
= temp;
ExpandedSubBlockEnd.gif}

ExpandedSubBlockStart.gifContractedSubBlock.gif
/**//*
InBlock.gif原版函数,会出现脚本变量溢出错误
InBlock.gifinsert_content();
InBlock.gif
InBlock.gif
InBlock.gifvar if_max = true;
InBlock.giffunction show_CW(){
InBlock.gif    window.moveTo(10000, 10000);
InBlock.gif    if(if_max){
InBlock.gif        New_CW.show(CW_top, CW_left, CW_width, CW_height);
InBlock.gif        if(typeof(New_CW.document.all.include)!="undefined"){
InBlock.gif            New_CW.document.all.include.style.width = CW_width;
InBlock.gif            New_CW.document.all.Max.innerText = "1";
InBlock.gif        }
InBlock.gif        
InBlock.gif    }else{
InBlock.gif        New_CW.show(0, 0, screen.width, screen.height);
InBlock.gif        New_CW.document.all.include.style.width = screen.width;
InBlock.gif    }
InBlock.gif}
InBlock.gif
ExpandedSubBlockEnd.gif
*/

InBlock.gif
//----------------------------------------
ExpandedSubBlockStart.gifContractedSubBlock.gif
/**//*
InBlock.gif修改后的函数,解决了脚本溢出问题,但是在WinXP下,多次重复点击,仍然有可能出现错误
ExpandedSubBlockEnd.gif
*/

InBlock.gif
var if_max = true;
InBlock.gifsetTimeout(
"insert_content()",500);
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function show_CW()dot.gif{
InBlock.gif    window.moveTo(
1000010000);
ExpandedSubBlockStart.gifContractedSubBlock.gif    
if(if_max || New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)dot.gif{
InBlock.gif        New_CW.show(CW_top, CW_left, CW_width, CW_height);
InBlock.gif        New_CW.document.all.include.style.width 
= CW_width;
InBlock.gif        New_CW.document.all.Max.innerText 
= 2;
ExpandedSubBlockStart.gifContractedSubBlock.gif    }
elsedot.gif{
InBlock.gif        New_CW.show(
00, screen.width, screen.height);
InBlock.gif        New_CW.document.all.include.style.width 
= screen.width;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif}

InBlock.gif
InBlock.gif
InBlock.gif
//-----------------------------------------
InBlock.gif

InBlock.gif
InBlock.gif
InBlock.gifwindow.onfocus  
= show_CW;
InBlock.gifwindow.onresize 
= show_CW;
InBlock.gif
InBlock.gif
// Move Window
InBlock.gif
var drag_x,drag_y,draging=false
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function drag_move(e)dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif    
if (draging)dot.gif{
InBlock.gif        New_CW.show(e.screenX
-drag_x, e.screenY-drag_y, CW_width, CW_height);
InBlock.gif        
return false;
ExpandedSubBlockEnd.gif    }

ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function drag_down(e)dot.gif{
InBlock.gif    
if(e.button==2)return;
InBlock.gif    
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height)return;
InBlock.gif    drag_x
=e.clientX;
InBlock.gif    drag_y
=e.clientY;
InBlock.gif    draging
=true;
InBlock.gif    e.srcElement.setCapture();
ExpandedSubBlockEnd.gif}

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif
function drag_up(e)dot.gif{
InBlock.gif    draging
=false;
InBlock.gif    e.srcElement.releaseCapture();
InBlock.gif    
if(New_CW.document.body.offsetWidth==screen.width && New_CW.document.body.offsetHeight==screen.height) return;
InBlock.gif    CW_top  
= e.screenX-drag_x;
InBlock.gif    CW_left 
= e.screenY-drag_y;
ExpandedSubBlockEnd.gif}

ExpandedBlockEnd.gif
None.gif
</SCRIPT>
None.gif
</HTML>

default.htm可以是这样:
None.gif<html>
None.gif    
<head>
None.gif        
<title>LifeWithDVD</title>
None.gif        
<meta http-equiv="Content-Type" content="text/html; charset=GB2312">
None.gif    
<script id=clientEventHandlersJS language=javascript>
None.gif
<!--
None.gif
None.giffunction btn_onclick() {
None.gif//window.close();
None.gifalert(Text3.value+Text1.value);
None.gifreturn false;
None.gif}
None.gif
None.gif//--
>
None.gif
</script>
None.gif
</head>
None.gif    
<body>
None.gif        
<Div>
None.gif            User Name
<INPUT id="Text3" type="text" name="Text1"><br>
None.gif            Password 
<INPUT id="Text1" type="text" name="Text1"><br>
None.gif            
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
None.gif            
<input id="btn" type="button" name="btnsubmit" value="submit" onclick="return btn_onclick()">
None.gif        
</Div>
None.gif    
</body>
None.gif
</html>
None.gif

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值