javascriptdiv弹出可拖动窗口发布.txt
《javascriptdiv弹出可拖动窗口发布.txt》由会员分享,可在线阅读,更多相关《javascriptdiv弹出可拖动窗口发布.txt(7页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 /* * div 1DivWindow(id,title,width,height,content) id id title width height content 2 closeDivWindow(id) id id 3setPopupTopTitleFontColor(PopupTopTitleFontColor) 4setPopupTopBgColor(tBgColor) 5setPopupColor(borderColor,bgColor,tFontColor,cBgColor,fColor) ,屳 6open() var a = new DivWindow(1,580,400,W
2、elcome to visited my personal website:ahref=http:/www . thx!=).L); a.setPopupTopBgColor(black,blue,white,white,black); a.open(); html div title maxORmin close content author Nieger Dai date 2007.11.15 */ var isIe = (document.all)?true:false; var moveable=false; var topDivBorderColor = #3366
3、99;/ var topDivBgColor = #6795B4;/ var contentBgColor = white;/ var contentFontColor = black;/ var titleFontColor = white; / var index=10000;/z-index; / function DivWindow(id,title,w,h,content) this.id = id;/id this.zIndex = index +2; this.title = title;/ this.message = content;/ this.width = w;/ th
4、is.height = h;/ this.left = (document.body.clientWidth) ? (document.body.clientWidth - this.width)/2 : 0;/ this.top = (document.body.clientHeight) ? (document.body.clientHeight - this.height)/2 : 0;/ /this.init = init; /this.init(); /趨 DivWindow.prototype = / setPopupTopTitleFontColor:function(tFont
5、Color) titleFontColor = tFontColor; , / setPopupTopBgColor:function(tBgColor) topDivBgColor = tBgColor; , /,setPopupColor:function(borderColor,bgColor,tFontColor,cBgColor,fColor) topDivBorderColor = borderColor; topDivBgColor = bgColor; titleFontColor = tFontColor; contentBgColor = cBgColor; content
6、FontColor = fColor; , / open: function() var sWidth,sHeight; sWidth=document.body.clientWidth; sHeight=document.body.clientHeight; var bgObj=document.createElement(div); bgObj.setAttribute(id,window+this.id); var styleStr=top:0px;left:0px;position:absolute;background:#245;width:+sWidth+px;height:+sH
7、eight+px; styleStr+=(isIe)?filter:alpha(opacity=0);:opacity:0; bgObj.style.cssText=styleStr; document.body.appendChild(bgObj); / showBackground(bgObj,25); / 屳 var windowTopBgDiv = document.createElement(div); windowTopBgDiv.setAttribute(id,windowTopBg+this.id); windowTopBgDiv.style.position
8、 = absolute; windowTopBgDiv.style.zIndex = this.zIndex ; windowTopBgDiv.style.width = this.width ; windowTopBgDiv.style.height = this.height; windowTopBgDiv.style.left = this.left; windowTopBgDiv.style.top = this.top; windowTopBgDiv.style.background = topDivBgColor; windowTopBgDiv.style.fontSize = 9
9、pt; windowTopBgDiv.style.cursor = default; windowTopBgDiv.style.border = 1px solid + topDivBorderColor; windowTopBgDiv.attachEvent(onmousedown,function() if(windowTopBgDiv.style.zIndex!=index) index = index + 2; var idx = index; windowTopBgDiv.style.zIndex=idx; ); / var windowTopDiv = document.creat
10、eElement(div); windowTopDiv.setAttribute(id,windowTop+this.id); windowTopDiv.style.position = absolute; windowTopDiv.style.background = topDivBgColor;/white; windowTopDiv.style.color = titleFontColor; windowTopDiv.style.cursor = move; windowTopDiv.style.height = 20; windowTopDiv.style.width = this.w
11、idth-2*2; /; windowTopDiv.attachEvent(onmousedown,function() if(event.button=1) /; windowTopDiv.setCapture(); /; var win = windowTopDiv.parentNode; /; x0 = event.clientX; y0 = event.clientY; x1 = parseInt(win.style.left); y1 = parseInt(win.style.top); /; /topDivBgColor = windowTopDiv.style.backgroun
12、dColor; /; /windowTopDiv.style.backgroundColor = topDivBorderColor; win.style.borderColor = topDivBorderColor; moveable = true; ); / windowTopDiv.attachEvent(onmouseup,function() if(moveable) var win = windowTopDiv.parentNode; win.style.borderColor = topDivBgColor; windowTopDiv.style.backgroundColor
13、 = topDivBgColor; windowTopDiv.releaseCapture(); moveable = false; ); / windowTopDiv.attachEvent(onmousemove,function() if(moveable) var win = windowTopDiv.parentNode; win.style.left = x1 + event.clientX - x0; win.style.top = y1 + event.clientY - y0; ); / windowTopDiv.attachEvent(ondblclick,function
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- javascriptdiv 弹出 拖动 窗口 发布
限制150内