/*代码思路
此代码会以fullscreen方式打开一个空白窗口,然后用window.resize改变其大小。
最后在以写入onload="location.replace='url'"的办法将网址改变。
打开的窗口会是一个带有FRAME的窗口,其中窗口顶端会有一个高22的框架网页。
此网页是用来操纵窗口移动及关闭。
*/

/*说明
代码分两个部分,但总共牵涉到5个HTML文件及4个图像文件
第一部分是用来打开窗口,放在哪个文件都无所谓。
第二部分是用来控制窗口的移动及关闭,必须放在指定的文件里。
在此代码里,5个html文件分别为:
1.html; 代码第一部分所在
load.html; 所打开的窗口,是一个框架网页
chromelesstit.html;代码第2部分所在
contacting.html;用来显示如'PAGE LOADING.."等临时信息的网页
main.html;真正的主网页
4个图像分别为
x_a.gif; active
x_d.gif; mouseDown
x_o.gif; mouseOver
以上三个文件分别代表关闭窗口图标的不同状态
none.gif; 用来遮盖chromelesstit.html
*/

/*使用方法
如果你想让一个文件,如1.html,中的某一个连接打开一个指像main.html的无边框窗口。
把代码第一部分放到该文件中。
然后将连接
<a herf="main.html">
改为
<a herf="#" onclick="doOpen()">
在该文件所在目录内
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个文件拷入改目录.
对于初学者,以上则足够了。如果想要更好的效果,自己改代码。
*/
<!--//代码第一部分。
function doOpen(){
theurl="main.html";
wname ="name";
w=750;
h=400;
/* 参数说明:
theurl="main.html"; 打开窗口的网址
wname ="name"; 打开窗口的name属性
w=750; 打开窗口的宽度
h=400; 打开窗口的高度
*/
open(theurl, wname, w, h);
};
function open(theURL, wname, W, H) {
var windowW = W;//确定网页的宽度
var windowH = H;//确定网页的高度
var windowX = Math.ceil( (window.screen.width - windowW) / 2 );
var windowY = Math.ceil( (window.screen.height - windowH) / 2 );//确定网页的坐标

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>


【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


无边框窗口代码详解的更多相关文章

  1. PHP分页显示制作详细讲解

    搞定了最重要的如何获取数据的问题以后,剩下的就仅仅是传递参数,构造合适的sql语句然后使用php从数据库内获取数据并显示了。

  2. Javascript代码在页面加载时的执行顺序介绍

    Javascript代码在页面加载时的执行顺序介绍,需要的朋友可以参考一下

  3. PHP 脚本:随心所欲的代码逐渐流行

    有些人认为PHP代表“个人主页”。有些人认为PHP是其发明者姓名的首字母缩写。他公开发布了最初的超文本预处理器源代码,以帮助其它的Web开发人员对在线内容执行类似的操作。由于PHP的入门级这一特性,一个开放源代码社区围绕着该语言成长起来,以帮助PHP开发变得更加简单。所有这些结果表明在最近3年里PHP的使用得到了爆炸性的增长。

  4. 教你如何写出可维护的JS代码

    在平时工作开发中,大部分开发人员都花费大量的时间在维护其他人员的代码。很难从头开始开发新代码,很多情况下都是以他人成果为基础的,或者新增修改需求,自己写的代码也会被其他开发人员调用,所以写好一份高质量可维护的代码就显得十分重要。

  5. vue 代码压缩优化方式

    这篇文章主要介绍了vue 代码压缩优化方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教

  6. Spring 代码技巧梳理总结让你爱不释手

    这篇文章主要分享了Spring 代码技巧梳理总结,文章围绕主题展开详细的内容介绍,具有一定的参考价值,需要的小伙伴可以参考一下

  7. pycharm中代码回滚到指定版本的两种实现方法(附带截图展示)

    在编写代码的时候,经常会出现写的代码存在一些问题,但是比较难以发现具体存在的问题在哪里,需要将带代码恢复到指定的版本,下面这篇文章主要给大家介绍了关于pycharm中代码回滚到指定版本的两种实现方法,需要的朋友可以参考下

  8. Javascript基础知识详解

    本篇适合javascript新手或者学了前端一段时间,对js概念不清晰的同学。本文将讲述几点对于初学者遇到的javascript的坑,相信对javascript基础薄弱的同学,可以加深对javascript的理解

  9. nodejs代码执行绕过的一些技巧汇总

    这篇文章主要给大家介绍了关于nodejs代码执行绕过的一些技巧,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧

  10. 无边框窗口代码详解

    第二部分是用来控制窗口的移动及关闭,必须放在指定的文件里。在此代码里,5个html文件分别为:1.html;代码第一部分所在load.html;所打开的窗口,是一个框架网页chromelesstit.html;代码第2部分所在contacting.html;用来显示如'PAGELOADING.."等临时信息的网页main.html;真正的主网页4个图像分别为x_a.gif;activex_d.gif;mouseDownx_o.gif;mouseOver以上三个文件分别代表关闭窗口图标的不同状态none.g

随机推荐

  1. Java利用POI实现导入导出Excel表格

    这篇文章主要为大家详细介绍了Java利用POI实现导入导出Excel表格,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

  2. Mybatis分页插件PageHelper手写实现示例

    这篇文章主要为大家介绍了Mybatis分页插件PageHelper手写实现示例,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪

  3. (jsp/html)网页上嵌入播放器(常用播放器代码整理)

    网页上嵌入播放器,只要在HTML上添加以上代码就OK了,下面整理了一些常用的播放器代码,总有一款适合你,感兴趣的朋友可以参考下哈,希望对你有所帮助

  4. Java 阻塞队列BlockingQueue详解

    本文详细介绍了BlockingQueue家庭中的所有成员,包括他们各自的功能以及常见使用场景,通过实例代码介绍了Java 阻塞队列BlockingQueue的相关知识,需要的朋友可以参考下

  5. Java异常Exception详细讲解

    异常就是不正常,比如当我们身体出现了异常我们会根据身体情况选择喝开水、吃药、看病、等 异常处理方法。 java异常处理机制是我们java语言使用异常处理机制为程序提供了错误处理的能力,程序出现的错误,程序可以安全的退出,以保证程序正常的运行等

  6. Java Bean 作用域及它的几种类型介绍

    这篇文章主要介绍了Java Bean作用域及它的几种类型介绍,Spring框架作为一个管理Bean的IoC容器,那么Bean自然是Spring中的重要资源了,那Bean的作用域又是什么,接下来我们一起进入文章详细学习吧

  7. 面试突击之跨域问题的解决方案详解

    跨域问题本质是浏览器的一种保护机制,它的初衷是为了保证用户的安全,防止恶意网站窃取数据。那怎么解决这个问题呢?接下来我们一起来看

  8. Mybatis-Plus接口BaseMapper与Services使用详解

    这篇文章主要为大家介绍了Mybatis-Plus接口BaseMapper与Services使用详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪

  9. mybatis-plus雪花算法增强idworker的实现

    今天聊聊在mybatis-plus中引入分布式ID生成框架idworker,进一步增强实现生成分布式唯一ID,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

  10. Spring JdbcTemplate执行数据库操作详解

    JdbcTemplate是Spring框架自带的对JDBC操作的封装,目的是提供统一的模板方法使对数据库的操作更加方便、友好,效率也不错,这篇文章主要介绍了Spring JdbcTemplate执行数据库操作,需要的朋友可以参考下

返回
顶部