Heim > Web-Frontend > js-Tutorial > Hauptteil

baidu博客的编辑友情链接的新的层窗口!经典~支持【FF】_javascript技巧

WBOY
Freigeben: 2016-05-16 19:19:13
Original
1735 Leute haben es durchsucht
\ \ ' + sFunc + '\ \ \ '; var sIfram = '\ \ '; var sBox = '\ \ \ '; var sBG = '\
\ '; this.show = function() { this.middle('dialogBox'); if ($('dialogIframBG')) { $('dialogIframBG').style.top = $('dialogBox').style.top; $('dialogIframBG').style.left = $('dialogBox').style.left; $('dialogIframBG').style.width = $('dialogBox').offsetWidth; $('dialogIframBG').style.height = $('dialogBox').offsetHeight; $('dialogIframBG').style.display = 'block'; } this.shadow(); } this.reset = function() { if(!bNotReloadOnClose){ top.location=top.location.href; } this.close(); } this.close = function() { if ($('dialogIframBG')) { $('dialogIframBG').style.display = 'none'; } $('dialogBox').style.display='none'; $('dialogBoxBG').style.display='none'; $('dialogBoxShadow').style.display = "none"; $('dialogBody').innerHTML = sBody; } this.html = function(_sHtml) { $("dialogBody").innerHTML = _sHtml; this.show(); } this.init = function(big_msg) { //alert("a"); $('dialogCase') ? $('dialogCase').parentNode.removeChild($('dialogCase')) : function(){}; var oDiv = document.createElement('span'); oDiv.id = "dialogCase"; if ('yes' == big_msg) { oDiv.innerHTML = sBG + sBox; } else { if (!is_opera_d) { oDiv.innerHTML = sBG + sIfram + sBox; } else { oDiv.innerHTML = sBG + sBox; } } document.body.appendChild(oDiv); $('dialogBoxBG').style.height = document.body.scrollHeight; } this.button = function(_sId, _sFuc) { if($(_sId)) { $(_sId).style.display = ''; if($(_sId).addEventListener) { if($(_sId).act) { $(_sId).removeEventListener('click', function(){eval($(_sId).act)}, false); } $(_sId).act = _sFuc; $(_sId).addEventListener('click', function(){eval(_sFuc)}, false); } else { if($(_sId).act) { $(_sId).detachEvent('onclick', function(){eval($(_sId).act)}); } $(_sId).act = _sFuc; $(_sId).attachEvent('onclick', function(){eval(_sFuc)}); } } } this.shadow = function() { var oShadow = $('dialogBoxShadow'); var oDialog = $('dialogBox'); oShadow['style']['position'] = "absolute"; oShadow['style']['background'] = "#000"; oShadow['style']['display'] = ""; oShadow['style']['opacity'] = "0.2"; oShadow['style']['filter'] = "alpha(opacity=20)"; oShadow['style']['top'] = oDialog.offsetTop + 6; oShadow['style']['left'] = oDialog.offsetLeft + 6; oShadow['style']['width'] = oDialog.offsetWidth; oShadow['style']['height'] = oDialog.offsetHeight; } this.open = function(_sUrl, _sMode) { this.show(); if(!_sMode || _sMode == "no" || _sMode == "yes"){ if(_sUrl.length>100) { $("dialogBody").innerHTML = _sUrl; } else { var openIframe = ""; $("dialogBody").innerHTML = openIframe; } } } this.showWindow = function(_sUrl, _iWidth, _iHeight, _sMode) { var oWindow; var sLeft = (screen.width) ? (screen.width - _iWidth)/2 : 0; var iTop = -80 + (screen.height - _iHeight)/2; iTop = iTop > 0 ? iTop : (screen.height - _iHeight)/2; var sTop = (screen.height) ? iTop : 0; if(window.showModalDialog && _sMode == "m"){ oWindow = window.showModalDialog(_sUrl,"","dialogWidth:" + _iWidth + "px;dialogheight:" + _iHeight + "px"); } else { oWindow = window.open(_sUrl, '', 'height=' + _iHeight + ', width=' + _iWidth + ', top=' + sTop + ', left=' + sLeft + ', toolbar=no, menubar=no, scrollbars=' + _sMode + ', resizable=no,location=no, status=no'); this.reset(); } } this.event = function(_sMsg, _sOk, _sCancel, _sClose) { $('dialogFunc').innerHTML = sFunc; $('dialogClose').innerHTML = sClose; $('dialogBodyBox') == null ? $('dialogBody').innerHTML = sBody : function(){}; if (width > 400 && height > 300) { $('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg : function(){}; $('dialogMsg') ? $('dialogMsg')['style']['fontWeight'] = "bold" : function(){}; $('dialogMsg') ? $('dialogMsg')['style']['fontSize'] = "15px" : function(){}; $('dialogMsg') ? $('dialogMsg')['style']['color'] = "#ff9900" : function(){}; $('dialogMsg') ? $('dialogMsg')['style']['height'] = "150px" : function(){}; } else { $('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg : function(){}; } _sOk && _sOk != "" ? this.button('dialogOk', _sOk) : $('dialogOk').style.display = 'none'; _sCancel && _sCancel != "" ? this.button('dialogCancel', _sCancel) : $('dialogCancel').style.display = 'none'; //_sOk ? this.button('dialogOk', _sOk) : _sOk == "" ? function(){} : $('dialogCancel').style.display = 'none'; //_sCancel ? this.button('dialogCancel', _sCancel) : _sCancel == "" ? function(){} : $('dialogCancel').style.display = 'none'; _sClose ? this.button('dialogBoxClose', _sClose) : function(){}; this.show(); } this.set = function(_oAttr, _sVal) { var oShadow = $('dialogBoxShadow'); var oDialog = $('dialogBox'); var oHeight = $('dialogHeight'); if(_sVal != '') { switch(_oAttr) { case 'title': $('dialogBoxTitle').innerHTML = _sVal; title = _sVal; break; case 'width': oDialog['style']['width'] = _sVal; width = _sVal; break; case 'height': oHeight['style']['height'] = _sVal; height = _sVal; break; case 'src': $('dialogMsgDiv').innerHTML = '\ \ \ \ \ \
baidu博客的编辑友情链接的新的层窗口!经典~支持【FF】_javascript技巧
\ '; $('dialogBoxFace') ? $('dialogBoxFace').src = path + _sVal + '.gif' : function(){}; src = _sVal; break; case 'auto': auto = _sVal; } } this.middle('dialogBox'); oShadow['style']['top'] = oDialog.offsetTop + 6; oShadow['style']['left'] = oDialog.offsetLeft + 6; oShadow['style']['width'] = oDialog.offsetWidth; oShadow['style']['height'] = oDialog.offsetHeight; } this.moveStart = function (event, _sId) { IsDraging = true; oObj = $(_sId); document.onmousemove = mousemove; document.onmouseup = mouseup; document.setCapture ? oObj.setCapture() : function(){}; oEvent = window.event ? window.event : event; dragData = {x : oEvent.clientX, y : oEvent.clientY}; backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)}; function mousemove() { if(!IsDraging) return ; var oEvent = window.event ? window.event : event; var iLeft = oEvent.clientX - dragData["x"] + parseInt(oObj.style.left); var iTop = oEvent.clientY - dragData["y"] + parseInt(oObj.style.top); oObj.style.left = iLeft; oObj.style.top = iTop; $('dialogBoxShadow').style.left = iLeft + 6; $('dialogBoxShadow').style.top = iTop + 6; if ($('dialogIframBG')) { $('dialogIframBG').style.left = iLeft; $('dialogIframBG').style.top = iTop; } dragData = {x: oEvent.clientX, y: oEvent.clientY}; } function mouseup() { if(!IsDraging) return ; var oEvent = window.event ? window.event : event; document.onmousemove = null; document.onmouseup = null; if(oEvent.clientX document.body.clientWidth || oEvent.clientY > document.body.clientHeight){ oObj.style.left = backData.y; oObj.style.top = backData.x; $('dialogBoxShadow').style.left = backData.y + 6; $('dialogBoxShadow').style.top = backData.x + 6; if ($('dialogIframBG')) { $('dialogIframBG').style.left = backData.y; $('dialogIframBG').style.top = backData.x; } } IsDraging = false; oObj.releaseCapture ? oObj.releaseCapture() : function(){}; } } this.hideModule = function(_sType, _sDisplay) { var aIframe = parent.document.getElementsByTagName("iframe"); var aType = document.getElementsByTagName(_sType); var iChildObj, iChildLen; for (var i = 0; i 0 ? iTop : (sClientHeight / 2 + sScrollTop) - ($(_sId).offsetHeight / 2); if(sTop maxl) { ta.value = ta.value.substring(0,maxl); } else { zs.value = maxl - ta.value.length; } }
Quelle:php.cn
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage