divjstan.rar

  • PUDN用户
    了解作者
  • Java
    开发工具
  • 2KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 35
    下载次数
  • 2009-11-25 12:51
    上传日期
DIV+JS弹出提示框DIV+JS弹出提示框DIV+JS弹出提示框...
divjstan.rar
  • DIV+JS弹出提示框
  • divWindow_1.0.js
    5.6KB
内容介绍
function openDivWindow(width,height,leftMargin,topMargin,useMask,winTitle,closeBtn){ try{ closeDivWindow(); var divWin = createDivWindow(width,height,leftMargin,topMargin,winTitle,closeBtn); if(useMask) createMask(); return divWin; }catch(e){ } } function closeDivWindow(){ try{ removeDivWindow(); removeMask(); }catch(e){ } } function createDivWindow(width,height,leftMargin,topMargin,winTitle,closeBtn){ var divHtml = '<DIV id="_link_div_win" name="_link_div_win" style="'; divHtml += 'z-index:1001;margin:auto;POSITION: absolute;font-size: 12px;'; divHtml += 'BORDER-RIGHT: #708faf 1px solid;BORDER-TOP: #ffffff 1px solid;'; divHtml += 'BORDER-LEFT: #ffffff 1px solid;BORDER-BOTTOM: #708faf 1px solid;'; divHtml += 'font-weight: bold;BACKGROUND-COLOR: #FFFFFF;'; divHtml += 'filter:progid:DXImageTransform.Microsoft.Shadow(Color=#333333'; divHtml += ',Direction=120,strength=5);" class="tablebk"></DIV>'; var layoutTableHtml = '<TABLE width="100%" height="100%" align="center" cellpadding="0" cellspacing="0"'; layoutTableHtml += ' style="border: 1px solid #2E8EC9;">'; layoutTableHtml += '<TR height="25">'; layoutTableHtml += '<TD valign=center align=left width="80%" style="font-weight: bold;'; layoutTableHtml += 'color: #333333;FONT-FAMILY: 宋体;" background="images/bg_11.jpg">&nbsp;'; layoutTableHtml += '&nbsp;'; if(winTitle){ layoutTableHtml += winTitle; }else{ layoutTableHtml += 'Window'; } layoutTableHtml += '</TD><TD width="20%" align="right" background="images/bg_11.jpg">'; layoutTableHtml += ''; layoutTableHtml += '&nbsp;</TD></TR>'; layoutTableHtml += '<TR><TD valign=top align=center colspan="2">'; layoutTableHtml += '<DIV id="_link_div_win_content" name="_link_div_win_content"></DIV>'; layoutTableHtml += '</TD></TR>'; if(closeBtn){ layoutTableHtml += '<TR height="25">'; layoutTableHtml += '<TD valign=middle align=center colspan="2"'; layoutTableHtml += ' background="images/bg_11.jpg">'; layoutTableHtml += '<input type="button" class="anniu2" value=" 关 闭 "'; layoutTableHtml += ' style="cursor:pointer;" onclick="javascript:closeDivWindow();"></TD></TR>'; } layoutTableHtml += '</TABLE>'; var divWindow = document.createElement(divHtml); divWindow.style.width = width; divWindow.style.height = height; if(leftMargin == 'auto'){ divWindow.style.pixelLeft = (document.body.offsetWidth - width)/2 + document.body.scrollLeft; }else{ divWindow.style.pixelLeft = leftMargin + document.body.scrollLeft; } if(topMargin == 'auto'){ divWindow.style.pixelTop = (document.body.offsetHeight - height)/2 + document.body.scrollTop; }else{ divWindow.style.pixelTop = topMargin + document.body.scrollTop; } divWindow.innerHTML = layoutTableHtml; document.body.appendChild(divWindow); divWindow.setContent = function(contentHtml){ try{ document.getElementById("_link_div_win_content").innerHTML = contentHtml; }catch(e){ } }; var titleBar = divWindow.getElementsByTagName('TR')[0]; titleBar.onmousedown = function(){ this.style.cursor = 'move'; this.setCapture(); this.drag = true; divWindow.style._left = event.x - divWindow.offsetLeft; divWindow.style._top = event.y - divWindow.offsetTop; } titleBar.onmousemove = function(){ if(this.drag){ var _left = event.clientX - divWindow.style._left; var _top = event.clientY - divWindow.style._top; if(_left < 0){ divWindow.style.left = 0; }else if(_left > (document.body.clientWidth - divWindow.offsetWidth)){ divWindow.style.left = document.body.clientWidth - divWindow.offsetWidth; }else{ divWindow.style.left = _left; } if(_top < 0){ divWindow.style.top = 0; }else if(_top > (document.body.clientHeight - divWindow.offsetHeight)){ divWindow.style.top = document.body.clientHeight - divWindow.offsetHeight; }else{ divWindow.style.top = _top; } } } titleBar.onmouseup = function(){ this.style.cursor = ''; this.releaseCapture(); this.drag = false; } return divWindow; } function removeDivWindow(){ document.body.removeChild(document.getElementById('_link_div_win')); } function createMask(){ var maskDivHtml = '<div id="_link_div_win_mask" name="_link_div_win_mask" style="position:absolute;'; maskDivHtml += 'filter:alpha(opacity=20);background-color:#006699;'; maskDivHtml += 'top:0px;left:0px;width:100%;height:100%;z-index:1000;"></div>'; var maskDiv = document.createElement(maskDivHtml); var _scrollWidth = document.body.scrollWidth; var _scrollHeight = document.body.scrollHeight; var _clientWidth = document.body.clientWidth; var _clientHeight = document.body.clientHeight; maskDiv.style.width = _scrollWidth > _clientWidth ? _scrollWidth : _clientWidth; maskDiv.style.height = _scrollHeight > _clientHeight ? _scrollHeight : _clientHeight; document.body.appendChild(maskDiv); hideSelectBox(); } function removeMask(){ showSelectBox(); document.body.removeChild(document.getElementById('_link_div_win_mask')); } function hideSelectBox(){ var selectBoxs = document.getElementsByTagName("select"); for(var i=0;i<selectBoxs.length;i++){ selectBoxs[i].style.visibility = 'hidden'; } } function showSelectBox(){ var selectBoxs = document.getElementsByTagName("select"); for(var i=0;i<selectBoxs.length;i++){ selectBoxs[i].style.visibility = 'visible'; } }
评论
    相关推荐