用createPopup()方法来模似透明网页窗体

[入库:2005年8月18日] [更新:2007年3月25日]

本文简介:选择自 bluedestiny 的 blog

用createpopup()方法来模似透明网页窗体

<html xmlns:ie>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<ie:download id="include" style="behavior:url(#default#download)" />
<title>chromeless window</title>

<script language="jscript">
var cw_width = 400;
var cw_height = 300;
var cw_top = 100;
var cw_left = 100;
var cw_url = "/";
var new_cw = window.createpopup();
var cw_body = new_cw.document.body;
var content = "";
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;";

//build window
include.startdownload(cw_url, function(source){content=source});

function insert_content(){
 var temp = "";
 cw_body.style.overflow  = "hidden";
 cw_body.style.backgroundcolor = "white";
 cw_body.style.border  =  "solid black 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 style='filter: alpha(opacity=30)'>";
 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'>";
 temp += "<td style='color:#ffffff;padding-left:5px'>chromeless window for ie6 sp1</td>";
 temp += "<td style='color:#ffffff;padding-right:5px;' align=right>";
 temp += "<span id=help  onclick=\"alert('chromeless window for ie6 sp1  -  ver 1.0\\n\\ncode by windy_sk\\n\\nspecial thanks for andot')\" style=\""+csstext+"font-family:system;padding-right:2px;\">?</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>
</html>

本文关键:用createPopup()方法来模似透明网页窗体
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top