主题:  如何改良在IE6SP1下实现无边窗口的代码?

Liuying

职务:普通成员
等级:2
金币:1.0
发贴:303
注册:2002/4/13 2:22:40
#12003/11/14 15:56:40
我以前在网上找到一种在IE6SP1下实现无边窗口的代码,觉得不错,
现公开与大家分享并改良。

其特点如下:
1.不需过渡页直接打开 vip.5d.cn/marya/ie6sp1.htm
2.不支持绝对地址和框架
3.不支持IE6以下和其它浏览器
4.右键菜单虽然能打开,但是你别想在这里看到源代码,只能看到<html><body></body></html>
5.普遍不兼容其它特效

其代码如下:
引用:

<html>
<head>
<title>MARYA STUDIO</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<IE:Download ID="include" STYLE="behavior:url(#default#download)" />

<SCRIPT LANGUAGE="JScript">
/*--- Special Thanks For andot ---*/


/*--- Thanks For andot Again ---*/

var CW_width    = 796;
var CW_height    = 597;
var CW_top    = 10;
var CW_left    = 10;
var CW_url    = "";//--相对URL地址
var New_CW    = window.createPopup();
var CW_Body    = New_CW.document.body;
var content    = "";
var CSStext    = "margin:1px;color:#000000; 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:#3399CC;width:16px;height:15px;font-size:12px;line-height:11px;cursor:Default;";

//Build Window
include.startDownload(CW_url, function(source){content=source});

function insert_content(){
    var temp = "";
    CW_Body.style.overflow        = "hidden";
    CW_Body.style.backgroundColor    = "#666666";//--定义背景色
    CW_Body.style.border        = "solid #000000 1px";//--定义边框
    content = content.replace(/<a ([^>]*)>/g,"<a onclick=''''parent.open(this.href);return false'''' $1>");
    temp += "<table width=100% height=100% cellpadding=0 cellspacing=0 border=0>";
    temp += "<tr style='''';font-size:12px;background:#003399;height:18;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''''>";//--定义标题栏
    temp += "<td style=''''color:#FFFF00;padding-left:12px''''>::: 欢迎光临 ::: </td>";//--定义标题内容
    temp += "<td style=''''color:#FF0000;padding-right:1.8px;'''' align=right>";//--定义按钮位置
    temp += "<span id=Help onclick=\"alert(''''::: MARYA STUDIO ::: \\n\\n \\n\\n欢迎光临 版权所有 2003-05 Ver 1.0\\n\\n适用于 Internet Explorer 6 SP1'''')\" style=\""+CSStext+"font-family:System;padding-right:2px;\"title=''''关于 - About''''>?</span>";
    temp += "<span id=Min onclick=''''parent.New_CW.hide();parent.blur()'''' style=\""+CSStext+"font-family:Webdings;\" title=''''最小 - Minimum''''>0</span>";
    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>";
    temp += "<span id=Close onclick=''''parent.opener=null;parent.close()'''' style=\""+CSStext+"font-family:System;padding-right:2px;\" title=''''关闭 - Close''''>x</span>";
    temp += "</td></tr><tr><td colspan=2>";
    temp += "<div id=include style=''''overflow:scroll;overflow-x:hidden;overflow-y:auto; HEIGHT: 100%; width:"+CW_width+"''''>";
    temp += content;
    temp += "</div>";
    temp += "</td></tr></table>";
    CW_Body.innerHTML = temp;
}

setTimeout("insert_content()",1000);

var if_max = true;
function show_CW(){
    window.moveTo(10000, 10000);
    if(if_max){
        New_CW.show(CW_top, CW_left, CW_width, CW_height);
        if(typeof(New_CW.document.all.include)!="undefined"){
            New_CW.document.all.include.style.width = CW_width;
            New_CW.document.all.Max.innerText = "1";
        }
        
    }else{
        New_CW.show(0, 0, screen.width, screen.height);
        New_CW.document.all.include.style.width = screen.width;
    }
}

window.onfocus = show_CW;
window.onresize = show_CW;

// Move Window
var drag_x,drag_y,draging=false

function drag_move(e){
    if (draging){
        New_CW.show(e.screenX-drag_x, e.screenY-drag_y, CW_width, CW_height);
        return false;
    }
}

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

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

</SCRIPT>


</head>

<body>
请使用Internet Explorer 6
</body>
</html>




编辑历史:[此帖最近一次被 allinhands 编辑过(编辑时间:2004-08-27 09:13:35)]


不是高手

职务:普通成员
等级:3
金币:5.0
发贴:1352
注册:2002/8/23 2:27:18
#22003/11/14 16:50:46
嘿嘿,IE6SP1禁止了打开全屏窗口再resize的做法
现在又出来一个无边窗口,直觉告诉我可能是用createPopup做的,果然……



Liuying

职务:普通成员
等级:2
金币:1.0
发贴:303
注册:2002/4/13 2:22:40
#32003/11/14 17:08:07
IE6SP1不是禁止了打开全屏窗口



我佛山人

职务:版主
等级:4
金币:16.0
发贴:2269
注册:2002/8/7 15:09:27
#42003/11/14 23:02:04
这个不是经典windy2000写的么?

其实他用了download行为加载目标页,有很多限制,不支持动态页了

有个老外写的比较完整,是用Object加载网页的,不过Object难看的边框无法去掉

演示:
vip.5d.cn/xmercy/temp/SP1_CW.htm



Liuying

职务:普通成员
等级:2
金币:1.0
发贴:303
注册:2002/4/13 2:22:40
#52003/11/15 23:59:05
还是上面的好看



lj5

职务:普通成员
等级:1
金币:0.0
发贴:26
注册:2002/5/29 10:49:35
#62004/8/26 18:29:39

看不到代码?……