悬挂关闭的演示,可以展开、隐藏和关闭的div层

<HTML>
<HEAD>
<TITLE>悬挂关闭的演示,可以展开、隐藏和关闭的div层丨芯晴网页特效丨CsrCode.Cn</TITLE>
<meta http-equiv= " Content-Type " content= " text/html; charset=gb2312 ">
</HEAD>
<SCRIPT language=Javascript >
document.writeln( "");
document.writeln( " <style type=\'text\/css\'> ");
document.writeln( " <!-- ");
document.writeln( " a:visited{text-decoration:none;color:slategray;} ");
document.writeln( " a:hover{text-decoration:underline;color:slategray;} ");
document.writeln( " a:link{text-decoration:none;color:slategray;} ");
document.writeln( " --> ");
document.writeln( " <\/style> ");
document.writeln( " <script language=JScript> ");
document.writeln( " <!-- ");
document.writeln( " \/\/可以打包为js文件; ");
document.writeln( " var x0=0,y0=0,x1=0,y1=0; ");
document.writeln( " var offx=6,offy=6; ");
document.writeln( " var moveable=false; ");
document.writeln( " var hover=\'orange\',normal=\'slategray\';\/\/color; ");
document.writeln( " var index=10000;\/\/z-index; ");
document.writeln( " \/\/开始拖动; ");
document.writeln( " function startDrag(obj) ");
document.writeln( " { ");
document.writeln( "  if(event.button==1) ");
document.writeln( "  { ");
document.writeln( "   \/\/锁定标题栏; ");
document.writeln( "   obj.setCapture(); ");
document.writeln( "   \/\/定义对象; ");
document.writeln( "   var win = obj.parentNode; ");
document.writeln( "   var sha = win.nextSibling; ");
document.writeln( "   \/\/记录鼠标和层位置; ");
document.writeln( "   x0 = event.clientX; ");
document.writeln( "   y0 = event.clientY; ");
document.writeln( "   x1 = parseInt(win.style.left); ");
document.writeln( "   y1 = parseInt(win.style.top); ");
document.writeln( "   \/\/记录颜色; ");
document.writeln( "   normal = obj.style.backgroundColor; ");
document.writeln( "   \/\/改变风格; ");
document.writeln( "   obj.style.backgroundColor = hover; ");
document.writeln( "   win.style.borderColor = hover; ");
document.writeln( "   obj.nextSibling.style.color = hover; ");
document.writeln( "   sha.style.left = x1 + offx; ");
document.writeln( "   sha.style.top  = y1 + offy; ");
document.writeln( "   moveable = true; ");
document.writeln( "  } ");
document.writeln( " } ");
document.writeln( " \/\/拖动; ");
document.writeln( " function drag(obj) ");
document.writeln( " { ");
document.writeln( "  if(moveable) ");
document.writeln( "  { ");
document.writeln( "   var win = obj.parentNode; ");
document.writeln( "   var sha = win.nextSibling; ");
document.writeln( "   win.style.left = x1 + event.clientX - x0; ");
document.writeln( "   win.style.top  = y1 + event.clientY - y0; ");
document.writeln( "   sha.style.left = parseInt(win.style.left) + offx; ");
document.writeln( "   sha.style.top  = parseInt(win.style.top) + offy; ");
document.writeln( "  } ");
document.writeln( " } ");
document.writeln( " \/\/停止拖动; ");
document.writeln( " function stopDrag(obj) ");
document.writeln( " { ");
document.writeln( "  if(moveable) ");
document.writeln( "  { ");
document.writeln( "   var win = obj.parentNode; ");
document.writeln( "   var sha = win.nextSibling; ");
document.writeln( "   var msg = obj.nextSibling; ");
document.writeln( "   win.style.borderColor     = normal; ");
document.writeln( "   obj.style.backgroundColor = normal; ");
document.writeln( "   msg.style.color           = normal; ");
document.writeln( "   sha.style.left = obj.parentNode.style.left; ");
document.writeln( "   sha.style.top  = obj.parentNode.style.top; ");
document.writeln( "   obj.releaseCapture(); ");
document.writeln( "   moveable = false; ");
document.writeln( "  } ");
document.writeln( " } ");
document.writeln( " \/\/获得焦点; ");
document.writeln( " function getFocus(obj) ");
document.writeln( " { ");
document.writeln( "  if(obj.style.zIndex!=index) ");
document.writeln( "  { ");
document.writeln( "   index = index + 2; ");
document.writeln( "   var idx = index; ");
document.writeln( "   obj.style.zIndex=idx; ");
document.writeln( "   obj.nextSibling.style.zIndex=idx-1; ");
document.writeln( "  } ");
document.writeln( " } ");
document.writeln( " \/\/最小化; ");
document.writeln( " function min(obj) ");
document.writeln( " { ");
document.writeln( "  var win = obj.parentNode.parentNode; ");
document.writeln( "  var sha = win.nextSibling; ");
document.writeln( "  var tit = obj.parentNode; ");
document.writeln( "  var msg = tit.nextSibling; ");
document.writeln( "  var flg = msg.style.display==\"none\"; ");
document.writeln( "  if(flg) ");
document.writeln( "  { ");
document.writeln( "   win.style.height  = parseInt(msg.style.height) + parseInt(tit.style.height) + 2*2; ");
document.writeln( "   sha.style.height  = win.style.height; ");
document.writeln( "   msg.style.display = \"block\"; ");
document.writeln( "   obj.innerHTML = \"0\"; ");
document.writeln( "  } ");
document.writeln( "  else ");
document.writeln( "  { ");
document.writeln( "   win.style.height  = parseInt(tit.style.height) + 2*2; ");
document.writeln( "   sha.style.height  = win.style.height; ");
document.writeln( "   obj.innerHTML = \"2\"; ");
document.writeln( "   msg.style.display = \"none\"; ");
document.writeln( "  } ");
document.writeln( " } ");
document.writeln( " \/\/关闭; ");
document.writeln( " function cls(obj) ");
document.writeln( " { ");
document.writeln( "  var win = obj.parentNode.parentNode; ");
document.writeln( "  var sha = win.nextSibling; ");
document.writeln( "  win.style.visibility = \"hidden\"; ");
document.writeln( "  sha.style.visibility = \"hidden\"; ");
document.writeln( " } ");
document.writeln( " \/\/创建一个对象; ");
document.writeln( " function xWin(id,w,h,l,t,tit,msg) ");
document.writeln( " { ");
document.writeln( "  index = index+2; ");
document.writeln( "  this.id      = id; ");
document.writeln( "  this.width   = w; ");
document.writeln( "  this.height  = h; ");
document.writeln( "  this.left    = l; ");
document.writeln( "  this.top     = t; ");
document.writeln( "  this.zIndex  = index; ");
document.writeln( "  this.title   = tit; ");
document.writeln( "  this.message = msg; ");
document.writeln( "  this.obj     = null; ");
document.writeln( "  this.bulid   = bulid; ");
document.writeln( "  this.bulid(); ");
document.writeln( " } ");
document.writeln( " \/\/初始化; ");
document.writeln( " function bulid() ");
document.writeln( " { ");
document.writeln( "  var str = \"\" ");
document.writeln( "   + \"<div id=xMsg\" + this.id + \" \" ");
document.writeln( "   + \"style=\'\" ");
document.writeln( "   + \"z-index:\" + this.zIndex + \";\" ");
document.writeln( "   + \"width:\" + this.width + \";\" ");
document.writeln( "   + \"height:\" + this.height + \";\" ");
document.writeln( "   + \"left:\" + this.left + \";\" ");
document.writeln( "   + \"top:\" + this.top + \";\" ");
document.writeln( "   + \"background-color:\" + normal + \";\" ");
document.writeln( "   + \"color:\" + normal + \";\" ");
document.writeln( "   + \"font-size:10px;\" ");
document.writeln( "   + \"font-family:Verdana;\" ");
document.writeln( "   + \"position:absolute;\" ");
document.writeln( "   + \"cursor:default;\" ");
document.writeln( "   + \"border:2px solid \" + normal + \";\" ");
document.writeln( "   + \"\' \" ");
document.writeln( "   + \"οnmοusedοwn=\'getFocus(this)\'>\" ");
document.writeln( "    + \"<div \" ");
document.writeln( "    + \"style=\'\" ");
document.writeln( "    + \"background-color:\" + normal + \";\" ");
document.writeln( "    + \"width:\" + (this.width-2*2) + \";\" ");
document.writeln( "    + \"height:20;\" ");
document.writeln( "    + \"color:white;\" ");
document.writeln( "    + \"\' \" ");
document.writeln( "    + \"οnmοusedοwn=\'startDrag(this)\' \" ");
document.writeln( "    + \"οnmοuseup=\'stopDrag(this)\' \" ");
document.writeln( "    + \"οnmοusemοve=\'drag(this)\' \" ");
document.writeln( "    + \"οndblclick=\'min(this.childNodes[1])\'\" ");
document.writeln( "    + \">\" ");
document.writeln( "     + \"<span style=\'width:\" + (this.width-2*12-4) + \";padding-left:3px;\'>\" + this.title + \"<\/span>\" ");
document.writeln( "     + \"<span style=\'width:12;border-width:0px;color:white;font-family:webdings;\' οnclick=\'min(this)\'>0<\/span>\" ");
document.writeln( "     + \"<span style=\'width:12;border-width:0px;color:white;font-family:webdings;\' οnclick=\'cls(this)\'>r<\/span>\" ");
document.writeln( "    + \"<\/div>\" ");
document.writeln( "     + \"<div style=\'\" ");
document.writeln( "     + \"width:100%;\" ");
document.writeln( "     + \"height:\" + (this.height-20-4) + \";\" ");
document.writeln( "     + \"background-color:white;\" ");
document.writeln( "     + \"line-height:14px;\" ");
document.writeln( "     + \"word-break:break-all;\" ");
document.writeln( "     + \"padding:3px;\" ");
document.writeln( "     + \"\'>\" + this.message + \"<\/div>\" ");
document.writeln( "   + \"<\/div>\" ");
document.writeln( "   + \"<div style=\'\" ");
document.writeln( "   + \"width:\" + this.width + \";\" ");
document.writeln( "   + \"height:\" + this.height + \";\" ");
document.writeln( "   + \"top:\" + this.top + \";\" ");
document.writeln( "   + \"left:\" + this.left + \";\" ");
document.writeln( "   + \"z-index:\" + (this.zIndex-1) + \";\" ");
document.writeln( "   + \"position:absolute;\" ");
document.writeln( "   + \"background-color:black;\" ");
document.writeln( "   + \"filter:alpha(opacity=40);\" ");
document.writeln( "   + \"\'>by wildwind<\/div>\"; ");
document.writeln( "  document.body.insertAdjacentHTML(\"beforeEnd\",str); ");
document.writeln( " } ");
document.writeln( " \/\/--> ");
document.writeln( " <\/script> ");
document.writeln( "");
document.writeln( " <script language=\'JScript\'> ");
document.writeln( " <!-- ");
document.writeln( " function initialize() ");
document.writeln( " { ");
document.writeln( "  var a = new xWin(\"1\",800,200,0,0,\"欢迎你收藏本广告页面!\",\"欢迎光临<br><a href=http:\/\/\/wildcity target=_blank>http:\/\/<\/a><br>AD调用\"); ");
document.writeln( " } ");
document.writeln( " window.onload = initialize; ");
document.writeln( " \/\/--> ");
document.writeln( " <\/script> ");
document.writeln( "");
document.writeln( "")
</SCRIPT>
<BODY>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
</BODY>
</HTML>             

<br><br><hr><p align= " center "><font color=black>本特效由 <a href= " http://www.CsrCode.cn " target= " _blank ">芯晴网页特效</a>丨CsrCode.Cn 收集于互联网,只为兴趣与学习交流,不作商业用途。</font></p>

转载于:https://www.cnblogs.com/csr04/archive/2012/08/23/2652764.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值