鼠标单击连接在网页中弹出个性提示小窗口
var oDiv = document.createElement('span');
oDiv.id = "dialogCase";
oDiv.innerHTML = sBox;
document.body.appendChild(oDiv);
}
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"){
$("dialogBody").innerHTML = "<iframe id='dialogFrame' width='100%' height='100%' frameborder='0' scrolling='" + _sMode + "'></iframe>";
$("dialogFrame").src = _sUrl;
}
}
this.showWindow = function(_sUrl, _iWidth, _iHeight, _sMode){
var oWindow;
var sLeft = (screen.width) ? (screen.width - _iWidth)/2 : 0;
var sTop = (screen.height) ? (screen.height - _iHeight)/2 : 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.event = function(_sMsg, _sOk, _sCancel, _sClose){
$('dialogFunc').innerHTML = sFunc;
$('dialogClose').innerHTML = sClose;
$('dialogBodyBox') == null ? $('dialogBody').innerHTML = sBody : function(){};
$('dialogMsg') ? $('dialogMsg').innerHTML = _sMsg : function(){};
this.show();
_sOk ? this.button('dialogOk', _sOk) | $('dialogOk').focus() : $('dialogOk').style.display = 'none';
_sCancel ? this.button('dialogCancel', _sCancel) : $('dialogCancel').style.display = 'none';
_sClose ? this.button('dialogBoxClose', _sClose) : function(){};
//_sOk ? this.button('dialogOk', _sOk) : _sOk == "" ? function(){} : $('dialogOk').style.display = 'none';
//_sCancel ? this.button('dialogCancel', _sCancel) : _sCancel == "" ? function(){} : $('dialogCancel').style.display = 'none';
}
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':
if(parseInt(_sVal) > 0){
$('dialogBoxFace') ? $('dialogBoxFace').src = path + _sVal + '.gif' : function(){};
}else{
$('dialogBoxFace') ? $('dialogBoxFace').src = _sVal : function(){};
}
src = _sVal;
break;
}
}
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){
var oObj = $(_sId);
oObj.onmousemove = mousemove;
oObj.onmouseup = mouseup;
oObj.setCapture ? oObj.setCapture() : function(){};
oEvent = window.event ? window.event : event;
var dragData = {x : oEvent.clientX, y : oEvent.clientY};
var backData = {x : parseInt(oObj.style.top), y : parseInt(oObj.style.left)};
function mousemove(){
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;
关注此文读者还看过




