- 浏览: 427052 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
iwwenbo:
别逗好不好
Popup.js 弹出窗口 -
bugnuke:
尼玛 跑不了。。。
Popup.js 弹出窗口 -
tangzhifei:
创建Subversion授权文件放哪目录下?前面我的都对了,到 ...
Trac系列(8):windows下Apache+SVN+Trac安装及配置(一) -
zoutuo1986:
正在安装,确实很慢,一定要选择网速快的时候安装,
eclipse 插件springide安装 -
johnsonyang:
this.jmsTemplate.send(
...
spring,weblogic配置jms
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<script language='javascript' src='newPopup.js' charset="UTF-8">
</script>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY charset="UTF-8">
<Script Language="JavaScript">
function ShowIframe() //显u31034 iframe
{
var pop = new Popup({
contentType: 1,
isReloadOnClose: false,
width: 400,
height: 500
});
pop.setContent("contentUrl", "http://www.baidu.com");
pop.setContent("title", "框u26550 iframe示u20363 ");
pop.build();
pop.show();
}
function ShowHtmlString() //显u31034 html
{
var strHtml = "<table border=1 style='width:90%; text-align:center;'><tr style='height:40px'><td>ds</td><td>dads</td></tr><tr style='height:40px'><td>dadas</td><td>dasd</td></tr><tr style='height:40px'><td>dadasd</td><td>dsadads</td></tr></table>";
var pop = new Popup({
contentType: 2,
isReloadOnClose: false,
width: 340,
height: 300
});
pop.setContent("contentHtml", strHtml);
pop.setContent("title", "字u31526 串u31034 例tml");
pop.build();
pop.show();
}
function ShowAlert() //显u31034 警u31034 对u-29731 框
{
var pop = new Popup({
contentType: 4,
isReloadOnClose: true,
width: 340,
height: 80
});
pop.setContent("title", "警u21578 框u31034 例lert");
pop.setContent("alertCon", "alert对u-29731 框u30340 内u23481 ");
pop.build();
pop.show();
}
function ShowConfirm() //显u31034 确u-29788 对u-29731 框
{
var pop = new Popup({
contentType: 3,
isReloadOnClose: false,
width: 340,
height: 80
});
pop.setContent("title", "对u-29731 框u31034 例onfirm");
pop.setContent("confirmCon", "confirm对u-29731 框u30340 内u23481 ");
pop.setContent("callBack", ShowCallBack);
pop.setContent("parameter", {
id: "divCall",
str: "点u20987 确u23450 后u26174 示u30340 字u31526 串,
obj: pop
});
pop.build();
pop.show();
}
function ShowCallBack(para) //回u-29693 函u25968
{
var o_pop = para["obj"]
var obj = document.getElementById(para["id"]);
o_pop.close();
obj.innerText = para["str"];
}
/********Popup.js ***start*******************/
if (!Array.prototype.push) {
Array.prototype.push = function(){
var startLength = this.length;
for (var i = 0; i < arguments.length; i++)
this[startLength + i] = arguments[i];
return this.length;
}
};
function G(){
//alert("aa");
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element)
};
return elements
};
Function.prototype.bind = function(object){
var __method = this;
return function(){
__method.apply(object, arguments)
}
};
Function.prototype.bindAsEventListener = function(object){
var __method = this;
return function(event){
__method.call(object, event || window.event)
}
};
Object.extend = function(destination, source){
for (property in source) {
destination[property] = source[property]
};
return destination
};
if (!window.Event) {
var Event = new Object()
};
Object.extend(Event, {
observers: false,
element: function(event){
return event.target || event.srcElement
},
isLeftClick: function(event){
return (((event.which) && (event.which == 1)) || ((event.button) && (event.button == 1)))
},
pointerX: function(event){
return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft))
},
pointerY: function(event){
return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop))
},
stop: function(event){
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation()
}
else {
event.returnValue = false;
event.cancelBubble = true
}
},
findElement: function(event, tagName){
var element = Event.element(event);
while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element
},
_observeAndCache: function(element, name, observer, useCapture){
if (!this.observers)
this.observers = [];
if (element.addEventListener) {
this.observers.push([element, name, observer, useCapture]);
element.addEventListener(name, observer, useCapture)
}
else
if (element.attachEvent) {
this.observers.push([element, name, observer, useCapture]);
element.attachEvent('on' + name, observer)
}
},
unloadCache: function(){
if (!Event.observers)
return;
for (var i = 0; i < Event.observers.length; i++) {
Event.stopObserving.apply(this, Event.observers[i]);
Event.observers[i][0] = null
};
Event.observers = false
},
observe: function(element, name, observer, useCapture){
var element = G(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent))
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture)
},
stopObserving: function(element, name, observer, useCapture){
var element = G(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent))
name = 'keydown';
if (element.removeEventListener) {
element.removeEventListener(name, observer, useCapture)
}
else
if (element.detachEvent) {
element.detachEvent('on' + name, observer)
}
}
});
Event.observe(window, 'unload', Event.unloadCache, false);
var Class = function(){
var _class = function(){
this.initialize.apply(this, arguments)
};
for (i = 0; i < arguments.length; i++) {
superClass = arguments[i];
for (member in superClass.prototype) {
_class.prototype[member] = superClass.prototype[member]
}
};
_class.child = function(){
return new Class(this)
};
_class.extend = function(f){
for (property in f) {
_class.prototype[property] = f[property]
}
};
return _class
};
function space(flag){
if (flag == "begin") {
var ele = document.getElementById("ft");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "ft_popup";
ele = document.getElementById("usrbar");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "usrbar_popup"
}
else
if (flag == "end") {
var ele = document.getElementById("ft_popup");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "ft";
ele = document.getElementById("usrbar_popup");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "usrbar"
}
};
// Popup Class begin....
var Popup = new Class();
Popup.prototype = {
iframeIdName: 'ifr_popup', //iframe的u21517 字
initialize: function(config){
this.config = Object.extend({ //属u24615 设u32622
contentType: 1, //pop类u22411 1. 内u23884 iframe,. 显u31034 给u23450 的tml 3. confirm框4. alert框
isHaveTitle: true, //是u21542 有u26631 题u26639
scrollType: 'no', //内u23884 iframe是u21542 可u20197 滚u21160
isBackgroundCanClick: false, //背u26223 是u21542 可u20197 点u20987
isSupportDraging: true, //是u21542 支u25345 拖u21160
isShowShadow: true, //是u21542 显u31034 阴u24433
isReloadOnClose: true, //关u-27155 后u26159 否u-28211 新u21152 载u-26507 面
width: 400, //宽u24230
height: 300 //高u24230
}, config ||
{});
this.info = { //参u25968
shadowWidth: 4, //阴u24433 宽u24230
title: "", //标u-26472
contentUrl: "", //iframe的rl
contentHtml: "", //内u23481 的tml
callBack: null, //回u-29693 函u25968
parameter: null, //调u29992 的u21442 数如{id:"divCall",str:"点u20987 确u23450 后u26174 示u30340 字u31526 串,obj:pop}
confirmCon: "", //confirm的u20869 容
alertCon: "", //alert的u20869 容
someHiddenTag: "select,object,embed", //自u21160 隐u-31281 的u-26507 面u20803 素
someDisabledBtn: "", //禁u29992 的tn
someHiddenEle: "", //隐u-31281 的u21248 速
overlay: 0, //覆u30422
coverOpacity: 40 //蒙u30382 不u-28657 明u24230
};
this.color = {
cColor: "#EEEEEE", //蒙u30382 颜u-32142
bColor: "#FFFFFF", //背u26223 颜u-32142
tColor: "#48BBFA", //标u-26472 背u26223 颜u-32142 ,u-28743 框u-26468 色
wColor: "#FFFFFF" //标u-26472 文u23383 颜u-32142
};
this.dropClass = null;
this.someToHidden = [];
this.someToDisabled = [];
if (!this.config.isHaveTitle)
this.config.isSupportDraging = false;
this.iniBuild()
},
setContent: function(arrt, val){ //设u32622 内u23481 ,u21363 this.info 的u21442 数u20869 容
if (val != '') {
switch (arrt) {
case 'width':
this.config.width = val;
break;
case 'height':
this.config.height = val;
break;
case 'title':
this.info.title = val;
break;
case 'contentUrl':
this.info.contentUrl = val;
break;
case 'contentHtml':
this.info.contentHtml = val;
break;
case 'callBack':
this.info.callBack = val;
break;
case 'parameter':
this.info.parameter = val;
break;
case 'confirmCon':
this.info.confirmCon = val;
break;
case 'alertCon':
this.info.alertCon = val;
break;
case 'someHiddenTag':
this.info.someHiddenTag = val;
break;
case 'someHiddenEle':
this.info.someHiddenEle = val;
break;
case 'someDisabledBtn':
this.info.someDisabledBtn = val;
break;
case 'overlay':
this.info.overlay = val
}
}
},
iniBuild: function(){
G('dialogCase') ? G('dialogCase').parentNode.removeChild(G('dialogCase')) : function(){
};
var oDiv = document.createElement('span');
oDiv.id = 'dialogCase';
document.body.appendChild(oDiv)
},
build: function(){
var baseZIndex = 10001 + this.info.overlay * 10;
var showZIndex = baseZIndex + 2;
this.iframeIdName = 'ifr_popup' + this.info.overlay;
//关u-27155 按u-27474
//var path="http://img.baidu.com/hi/img/";
//var close='<input type="image" id="dialogBoxClose" src="'+path+'dialogclose.gif" border="0" width="16" height="16" align="absmiddle" title="关u-27155 "/>';
var close = '<a id="dialogBoxClose" title="关u-27155 " style="padding:0;font-weight:bold;color:#888;background:#C6E3FF;cursor:pointer;font-size:14px;font-family:Airal;">¡Á</a>';
var cB = 'filter: alpha(opacity=' + this.info.coverOpacity + ');opacity:' + this.info.coverOpacity / 100 + ';';
var cover = '<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:' + baseZIndex + ';' + cB + 'background-color:' + this.color.cColor + ';display:none;"></div>';
var mainBox = '<div id="dialogBox" style="border:1px solid ' + this.color.tColor + ';display:none;z-index:' + showZIndex + ';position:relative;width:' + this.config.width + 'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="' + this.color.bColor + '">';
if (this.config.isHaveTitle) {
mainBox += '<tr height="24" bgcolor="' + this.color.tColor + '"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>' + '<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:' + this.color.wColor + ';font-size:14px;font-weight:bold;">' + this.info.title + ' </td>' + '<td id="dialogClose" width="20" align="right" valign="middle">' + close + '</td><td width="6"></td></tr></table></td></tr>'
}
else {
mainBox += '<tr height="10"><td align="right">' + close + '</td></tr>'
};
mainBox += '<tr style="height:' + this.config.height + 'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>' + '<div id="dialogBoxShadow" style="display:none;z-index:' + baseZIndex + ';"></div>';
if (!this.config.isBackgroundCanClick) {
G('dialogCase').innerHTML = cover + mainBox;
G('dialogBoxBG').style.height = document.body.scrollHeight
}
else
G('dialogCase').innerHTML = mainBox;
Event.observe(G('dialogBoxClose'), "click", this.reset.bindAsEventListener(this), false);
if (this.config.isSupportDraging) {
dropClass = new Dragdrop(this.config.width, this.config.height, this.info.shadowWidth, this.config.isSupportDraging, this.config.contentType);
G("dialogBoxTitle").style.cursor = "move"
};
this.lastBuild()
},
lastBuild: function(){
var confirm = '<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">' + this.info.confirmCon + '</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确u23450 "/> <input id="dialogCancel" type="button" value=" 取u28040 "/></div></div>';
var alert = '<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">' + this.info.alertCon + '</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确u23450 "/></div></div>';
var baseZIndex = 10001 + this.info.overlay * 10;
var coverIfZIndex = baseZIndex + 4;
if (this.config.contentType == 1) {
var openIframe = "<iframe width='100%' style='height:" + this.config.height + "px' name='" + this.iframeIdName + "' id='" + this.iframeIdName + "' src='" + this.info.contentUrl + "' frameborder='0' scrolling='" + this.config.scrollType + "'></iframe>";
var coverIframe = "<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:" + coverIfZIndex + ";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";
G("dialogBody").innerHTML = openIframe + coverIframe
}
else
if (this.config.contentType == 2) {
G("dialogBody").innerHTML = this.info.contentHtml
}
else
if (this.config.contentType == 3) {
G("dialogBody").innerHTML = confirm;
Event.observe(G('dialogOk'), "click", this.forCallback.bindAsEventListener(this), false);
Event.observe(G('dialogCancel'), "click", this.close.bindAsEventListener(this), false)
}
else
if (this.config.contentType == 4) {
G("dialogBody").innerHTML = alert;
Event.observe(G('dialogYES'), "click", this.close.bindAsEventListener(this), false)
}
},
reBuild: function(){
G('dialogBody').height = G('dialogBody').clientHeight;
this.lastBuild()
},
show: function(){
this.hiddenSome();
this.middle();
if (this.config.isShowShadow)
this.shadow()
},
forCallback: function(){
return this.info.callBack(this.info.parameter)
},
shadow: function(){
var oShadow = G('dialogBoxShadow');
var oDialog = G('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 + this.info.shadowWidth;
oShadow['style']['left'] = oDialog.offsetLeft + this.info.shadowWidth;
oShadow['style']['width'] = oDialog.offsetWidth;
oShadow['style']['height'] = oDialog.offsetHeight
},
middle: function(){
if (!this.config.isBackgroundCanClick)
G('dialogBoxBG').style.display = '';
var oDialog = G('dialogBox');
oDialog['style']['position'] = "absolute";
oDialog['style']['display'] = '';
//取u24471 页u-26782 的u23485 度u21644 高u24230
var sClientWidth = document.body.clientWidth;
var sClientHeight = document.body.clientHeight;
var sScrollTop = document.body.scrollTop;
//
var sleft = (sClientWidth / 2) - (oDialog.offsetWidth / 2);
var iTop = -80 + (sClientHeight / 2 + sScrollTop) - (oDialog.offsetHeight / 2);
var sTop = iTop > 0 ? iTop : (sClientHeight / 2 + sScrollTop) - (oDialog.offsetHeight / 2);
if (sTop < 1)
sTop = "20";
if (sleft < 1)
sleft = "20";
oDialog['style']['left'] = sleft + "px"; //左u20391 位u32622
oDialog['style']['top'] = sTop + "px" //顶u-28440 位u32622
},
reset: function(){
if (this.config.isReloadOnClose) {
top.location.reload()
};
this.close()
},
close: function(){
G('dialogBox').style.display = 'none';
if (!this.config.isBackgroundCanClick)
G('dialogBoxBG').style.display = 'none';
if (this.config.isShowShadow)
G('dialogBoxShadow').style.display = 'none';
G('dialogBody').innerHTML = '';
this.showSome()
},
hiddenSome: function(){
var tag = this.info.someHiddenTag.split(",");
if (tag.length == 1 && tag[0] == "")
tag.length = 0;
for (var i = 0; i < tag.length; i++) {
this.hiddenTag(tag[i])
};
var ids = this.info.someHiddenEle.split(",");
if (ids.length == 1 && ids[0] == "")
ids.length = 0;
for (var i = 0; i < ids.length; i++) {
this.hiddenEle(ids[i])
};
var ids = this.info.someDisabledBtn.split(",");
if (ids.length == 1 && ids[0] == "")
ids.length = 0;
for (var i = 0; i < ids.length; i++) {
this.disabledBtn(ids[i])
};
space("begin")
},
disabledBtn: function(id){
var ele = document.getElementById(id);
if (typeof(ele) != "undefined" && ele != null && ele.disabled == false) {
ele.disabled = true;
this.someToDisabled.push(ele)
}
},
hiddenTag: function(tagName){
var ele = document.getElementsByTagName(tagName);
if (ele != null) {
for (var i = 0; i < ele.length; i++) {
if (ele[i].style.display != "none" && ele[i].style.visibility != 'hidden') {
ele[i].style.visibility = 'hidden';
this.someToHidden.push(ele[i])
}
}
}
},
hiddenEle: function(id){
var ele = document.getElementById(id);
if (typeof(ele) != "undefined" && ele != null) {
ele.style.visibility = 'hidden';
this.someToHidden.push(ele)
}
},
showSome: function(){
for (var i = 0; i < this.someToHidden.length; i++) {
this.someToHidden[i].style.visibility = 'visible'
};
for (var i = 0; i < this.someToDisabled.length; i++) {
this.someToDisabled[i].disabled = false
};
space("end")
}
};
var Dragdrop = new Class();
Dragdrop.prototype = {
initialize: function(width, height, shadowWidth, showShadow, contentType){
this.dragData = null;
this.dragDataIn = null;
this.backData = null;
this.width = width;
this.height = height;
this.shadowWidth = shadowWidth;
this.showShadow = showShadow;
this.contentType = contentType;
this.IsDraging = false;
this.oObj = G('dialogBox');
Event.observe(G('dialogBoxTitle'), "mousedown", this.moveStart.bindAsEventListener(this), false)
},
moveStart: function(event){
this.IsDraging = true;
if (this.contentType == 1) {
G("iframeBG").style.display = "";
G("iframeBG").style.width = this.width;
G("iframeBG").style.height = this.height
};
Event.observe(document, "mousemove", this.mousemove.bindAsEventListener(this), false);
Event.observe(document, "mouseup", this.mouseup.bindAsEventListener(this), false);
Event.observe(document, "selectstart", this.returnFalse, false);
this.dragData = {
x: Event.pointerX(event),
y: Event.pointerY(event)
};
this.backData = {
x: parseInt(this.oObj.style.left),
y: parseInt(this.oObj.style.top)
}
},
mousemove: function(event){
if (!this.IsDraging)
return;
var iLeft = Event.pointerX(event) - this.dragData["x"] + parseInt(this.oObj.style.left);
var iTop = Event.pointerY(event) - this.dragData["y"] + parseInt(this.oObj.style.top);
if (this.dragData["y"] < parseInt(this.oObj.style.top))
iTop = iTop - 12;
else
if (this.dragData["y"] > parseInt(this.oObj.style.top) + 25)
iTop = iTop + 12;
this.oObj.style.left = iLeft;
this.oObj.style.top = iTop;
if (this.showShadow) {
G('dialogBoxShadow').style.left = iLeft + this.shadowWidth;
G('dialogBoxShadow').style.top = iTop + this.shadowWidth
};
this.dragData = {
x: Event.pointerX(event),
y: Event.pointerY(event)
};
document.body.style.cursor = "move"
},
mouseup: function(event){
if (!this.IsDraging)
return;
if (this.contentType == 1)
G("iframeBG").style.display = "none";
document.onmousemove = null;
document.onmouseup = null;
var mousX = Event.pointerX(event) - (document.documentElement.scrollLeft || document.body.scrollLeft);
var mousY = Event.pointerY(event) - (document.documentElement.scrollTop || document.body.scrollTop);
if (mousX < 1 || mousY < 1 || mousX > document.body.clientWidth || mousY > document.body.clientHeight) {
this.oObj.style.left = this.backData["x"];
this.oObj.style.top = this.backData["y"];
if (this.showShadow) {
G('dialogBoxShadow').style.left = this.backData.x + this.shadowWidth;
G('dialogBoxShadow').style.top = this.backData.y + this.shadowWidth
}
};
this.IsDraging = false;
document.body.style.cursor = "";
Event.stopObserving(document, "selectstart", this.returnFalse, false)
},
returnFalse: function(){
return false
}
};
/*****************Popup.js ****end*******************/
</Script>
<INPUT TYPE="button" value="ShowHtmlString()" onclick="ShowHtmlString();">
<br>
<INPUT TYPE="button" value="ShowIframe()" onclick="ShowIframe();">
<br>
<INPUT TYPE="button" value="ShowAlert()" onclick="ShowAlert();">
<br>
<INPUT TYPE="button" value="ShowConfirm()" onclick="ShowConfirm();">
</BODY>
</HTML>
<HTML>
<HEAD>
<script language='javascript' src='newPopup.js' charset="UTF-8">
</script>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY charset="UTF-8">
<Script Language="JavaScript">
function ShowIframe() //显u31034 iframe
{
var pop = new Popup({
contentType: 1,
isReloadOnClose: false,
width: 400,
height: 500
});
pop.setContent("contentUrl", "http://www.baidu.com");
pop.setContent("title", "框u26550 iframe示u20363 ");
pop.build();
pop.show();
}
function ShowHtmlString() //显u31034 html
{
var strHtml = "<table border=1 style='width:90%; text-align:center;'><tr style='height:40px'><td>ds</td><td>dads</td></tr><tr style='height:40px'><td>dadas</td><td>dasd</td></tr><tr style='height:40px'><td>dadasd</td><td>dsadads</td></tr></table>";
var pop = new Popup({
contentType: 2,
isReloadOnClose: false,
width: 340,
height: 300
});
pop.setContent("contentHtml", strHtml);
pop.setContent("title", "字u31526 串u31034 例tml");
pop.build();
pop.show();
}
function ShowAlert() //显u31034 警u31034 对u-29731 框
{
var pop = new Popup({
contentType: 4,
isReloadOnClose: true,
width: 340,
height: 80
});
pop.setContent("title", "警u21578 框u31034 例lert");
pop.setContent("alertCon", "alert对u-29731 框u30340 内u23481 ");
pop.build();
pop.show();
}
function ShowConfirm() //显u31034 确u-29788 对u-29731 框
{
var pop = new Popup({
contentType: 3,
isReloadOnClose: false,
width: 340,
height: 80
});
pop.setContent("title", "对u-29731 框u31034 例onfirm");
pop.setContent("confirmCon", "confirm对u-29731 框u30340 内u23481 ");
pop.setContent("callBack", ShowCallBack);
pop.setContent("parameter", {
id: "divCall",
str: "点u20987 确u23450 后u26174 示u30340 字u31526 串,
obj: pop
});
pop.build();
pop.show();
}
function ShowCallBack(para) //回u-29693 函u25968
{
var o_pop = para["obj"]
var obj = document.getElementById(para["id"]);
o_pop.close();
obj.innerText = para["str"];
}
/********Popup.js ***start*******************/
if (!Array.prototype.push) {
Array.prototype.push = function(){
var startLength = this.length;
for (var i = 0; i < arguments.length; i++)
this[startLength + i] = arguments[i];
return this.length;
}
};
function G(){
//alert("aa");
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element)
};
return elements
};
Function.prototype.bind = function(object){
var __method = this;
return function(){
__method.apply(object, arguments)
}
};
Function.prototype.bindAsEventListener = function(object){
var __method = this;
return function(event){
__method.call(object, event || window.event)
}
};
Object.extend = function(destination, source){
for (property in source) {
destination[property] = source[property]
};
return destination
};
if (!window.Event) {
var Event = new Object()
};
Object.extend(Event, {
observers: false,
element: function(event){
return event.target || event.srcElement
},
isLeftClick: function(event){
return (((event.which) && (event.which == 1)) || ((event.button) && (event.button == 1)))
},
pointerX: function(event){
return event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft))
},
pointerY: function(event){
return event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop))
},
stop: function(event){
if (event.preventDefault) {
event.preventDefault();
event.stopPropagation()
}
else {
event.returnValue = false;
event.cancelBubble = true
}
},
findElement: function(event, tagName){
var element = Event.element(event);
while (element.parentNode && (!element.tagName || (element.tagName.toUpperCase() != tagName.toUpperCase())))
element = element.parentNode;
return element
},
_observeAndCache: function(element, name, observer, useCapture){
if (!this.observers)
this.observers = [];
if (element.addEventListener) {
this.observers.push([element, name, observer, useCapture]);
element.addEventListener(name, observer, useCapture)
}
else
if (element.attachEvent) {
this.observers.push([element, name, observer, useCapture]);
element.attachEvent('on' + name, observer)
}
},
unloadCache: function(){
if (!Event.observers)
return;
for (var i = 0; i < Event.observers.length; i++) {
Event.stopObserving.apply(this, Event.observers[i]);
Event.observers[i][0] = null
};
Event.observers = false
},
observe: function(element, name, observer, useCapture){
var element = G(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.attachEvent))
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture)
},
stopObserving: function(element, name, observer, useCapture){
var element = G(element);
useCapture = useCapture || false;
if (name == 'keypress' && (navigator.appVersion.match(/Konqueror|Safari|KHTML/) || element.detachEvent))
name = 'keydown';
if (element.removeEventListener) {
element.removeEventListener(name, observer, useCapture)
}
else
if (element.detachEvent) {
element.detachEvent('on' + name, observer)
}
}
});
Event.observe(window, 'unload', Event.unloadCache, false);
var Class = function(){
var _class = function(){
this.initialize.apply(this, arguments)
};
for (i = 0; i < arguments.length; i++) {
superClass = arguments[i];
for (member in superClass.prototype) {
_class.prototype[member] = superClass.prototype[member]
}
};
_class.child = function(){
return new Class(this)
};
_class.extend = function(f){
for (property in f) {
_class.prototype[property] = f[property]
}
};
return _class
};
function space(flag){
if (flag == "begin") {
var ele = document.getElementById("ft");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "ft_popup";
ele = document.getElementById("usrbar");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "usrbar_popup"
}
else
if (flag == "end") {
var ele = document.getElementById("ft_popup");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "ft";
ele = document.getElementById("usrbar_popup");
if (typeof(ele) != "undefined" && ele != null)
ele.id = "usrbar"
}
};
// Popup Class begin....
var Popup = new Class();
Popup.prototype = {
iframeIdName: 'ifr_popup', //iframe的u21517 字
initialize: function(config){
this.config = Object.extend({ //属u24615 设u32622
contentType: 1, //pop类u22411 1. 内u23884 iframe,. 显u31034 给u23450 的tml 3. confirm框4. alert框
isHaveTitle: true, //是u21542 有u26631 题u26639
scrollType: 'no', //内u23884 iframe是u21542 可u20197 滚u21160
isBackgroundCanClick: false, //背u26223 是u21542 可u20197 点u20987
isSupportDraging: true, //是u21542 支u25345 拖u21160
isShowShadow: true, //是u21542 显u31034 阴u24433
isReloadOnClose: true, //关u-27155 后u26159 否u-28211 新u21152 载u-26507 面
width: 400, //宽u24230
height: 300 //高u24230
}, config ||
{});
this.info = { //参u25968
shadowWidth: 4, //阴u24433 宽u24230
title: "", //标u-26472
contentUrl: "", //iframe的rl
contentHtml: "", //内u23481 的tml
callBack: null, //回u-29693 函u25968
parameter: null, //调u29992 的u21442 数如{id:"divCall",str:"点u20987 确u23450 后u26174 示u30340 字u31526 串,obj:pop}
confirmCon: "", //confirm的u20869 容
alertCon: "", //alert的u20869 容
someHiddenTag: "select,object,embed", //自u21160 隐u-31281 的u-26507 面u20803 素
someDisabledBtn: "", //禁u29992 的tn
someHiddenEle: "", //隐u-31281 的u21248 速
overlay: 0, //覆u30422
coverOpacity: 40 //蒙u30382 不u-28657 明u24230
};
this.color = {
cColor: "#EEEEEE", //蒙u30382 颜u-32142
bColor: "#FFFFFF", //背u26223 颜u-32142
tColor: "#48BBFA", //标u-26472 背u26223 颜u-32142 ,u-28743 框u-26468 色
wColor: "#FFFFFF" //标u-26472 文u23383 颜u-32142
};
this.dropClass = null;
this.someToHidden = [];
this.someToDisabled = [];
if (!this.config.isHaveTitle)
this.config.isSupportDraging = false;
this.iniBuild()
},
setContent: function(arrt, val){ //设u32622 内u23481 ,u21363 this.info 的u21442 数u20869 容
if (val != '') {
switch (arrt) {
case 'width':
this.config.width = val;
break;
case 'height':
this.config.height = val;
break;
case 'title':
this.info.title = val;
break;
case 'contentUrl':
this.info.contentUrl = val;
break;
case 'contentHtml':
this.info.contentHtml = val;
break;
case 'callBack':
this.info.callBack = val;
break;
case 'parameter':
this.info.parameter = val;
break;
case 'confirmCon':
this.info.confirmCon = val;
break;
case 'alertCon':
this.info.alertCon = val;
break;
case 'someHiddenTag':
this.info.someHiddenTag = val;
break;
case 'someHiddenEle':
this.info.someHiddenEle = val;
break;
case 'someDisabledBtn':
this.info.someDisabledBtn = val;
break;
case 'overlay':
this.info.overlay = val
}
}
},
iniBuild: function(){
G('dialogCase') ? G('dialogCase').parentNode.removeChild(G('dialogCase')) : function(){
};
var oDiv = document.createElement('span');
oDiv.id = 'dialogCase';
document.body.appendChild(oDiv)
},
build: function(){
var baseZIndex = 10001 + this.info.overlay * 10;
var showZIndex = baseZIndex + 2;
this.iframeIdName = 'ifr_popup' + this.info.overlay;
//关u-27155 按u-27474
//var path="http://img.baidu.com/hi/img/";
//var close='<input type="image" id="dialogBoxClose" src="'+path+'dialogclose.gif" border="0" width="16" height="16" align="absmiddle" title="关u-27155 "/>';
var close = '<a id="dialogBoxClose" title="关u-27155 " style="padding:0;font-weight:bold;color:#888;background:#C6E3FF;cursor:pointer;font-size:14px;font-family:Airal;">¡Á</a>';
var cB = 'filter: alpha(opacity=' + this.info.coverOpacity + ');opacity:' + this.info.coverOpacity / 100 + ';';
var cover = '<div id="dialogBoxBG" style="position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:' + baseZIndex + ';' + cB + 'background-color:' + this.color.cColor + ';display:none;"></div>';
var mainBox = '<div id="dialogBox" style="border:1px solid ' + this.color.tColor + ';display:none;z-index:' + showZIndex + ';position:relative;width:' + this.config.width + 'px;"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="' + this.color.bColor + '">';
if (this.config.isHaveTitle) {
mainBox += '<tr height="24" bgcolor="' + this.color.tColor + '"><td><table style="-moz-user-select:none;height:24px;" width="100%" border="0" cellpadding="0" cellspacing="0" ><tr>' + '<td width="6" height="24"></td><td id="dialogBoxTitle" style="color:' + this.color.wColor + ';font-size:14px;font-weight:bold;">' + this.info.title + ' </td>' + '<td id="dialogClose" width="20" align="right" valign="middle">' + close + '</td><td width="6"></td></tr></table></td></tr>'
}
else {
mainBox += '<tr height="10"><td align="right">' + close + '</td></tr>'
};
mainBox += '<tr style="height:' + this.config.height + 'px" valign="top"><td id="dialogBody" style="position:relative;"></td></tr></table></div>' + '<div id="dialogBoxShadow" style="display:none;z-index:' + baseZIndex + ';"></div>';
if (!this.config.isBackgroundCanClick) {
G('dialogCase').innerHTML = cover + mainBox;
G('dialogBoxBG').style.height = document.body.scrollHeight
}
else
G('dialogCase').innerHTML = mainBox;
Event.observe(G('dialogBoxClose'), "click", this.reset.bindAsEventListener(this), false);
if (this.config.isSupportDraging) {
dropClass = new Dragdrop(this.config.width, this.config.height, this.info.shadowWidth, this.config.isSupportDraging, this.config.contentType);
G("dialogBoxTitle").style.cursor = "move"
};
this.lastBuild()
},
lastBuild: function(){
var confirm = '<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">' + this.info.confirmCon + '</div><div style="margin:20px;"><input id="dialogOk" type="button" value=" 确u23450 "/> <input id="dialogCancel" type="button" value=" 取u28040 "/></div></div>';
var alert = '<div style="width:100%;height:100%;text-align:center;"><div style="margin:20px 20px 0 20px;font-size:14px;line-height:16px;color:#000000;">' + this.info.alertCon + '</div><div style="margin:20px;"><input id="dialogYES" type="button" value=" 确u23450 "/></div></div>';
var baseZIndex = 10001 + this.info.overlay * 10;
var coverIfZIndex = baseZIndex + 4;
if (this.config.contentType == 1) {
var openIframe = "<iframe width='100%' style='height:" + this.config.height + "px' name='" + this.iframeIdName + "' id='" + this.iframeIdName + "' src='" + this.info.contentUrl + "' frameborder='0' scrolling='" + this.config.scrollType + "'></iframe>";
var coverIframe = "<div id='iframeBG' style='position:absolute;top:0px;left:0px;width:1px;height:1px;z-index:" + coverIfZIndex + ";filter: alpha(opacity=00);opacity:0.00;background-color:#ffffff;'><div>";
G("dialogBody").innerHTML = openIframe + coverIframe
}
else
if (this.config.contentType == 2) {
G("dialogBody").innerHTML = this.info.contentHtml
}
else
if (this.config.contentType == 3) {
G("dialogBody").innerHTML = confirm;
Event.observe(G('dialogOk'), "click", this.forCallback.bindAsEventListener(this), false);
Event.observe(G('dialogCancel'), "click", this.close.bindAsEventListener(this), false)
}
else
if (this.config.contentType == 4) {
G("dialogBody").innerHTML = alert;
Event.observe(G('dialogYES'), "click", this.close.bindAsEventListener(this), false)
}
},
reBuild: function(){
G('dialogBody').height = G('dialogBody').clientHeight;
this.lastBuild()
},
show: function(){
this.hiddenSome();
this.middle();
if (this.config.isShowShadow)
this.shadow()
},
forCallback: function(){
return this.info.callBack(this.info.parameter)
},
shadow: function(){
var oShadow = G('dialogBoxShadow');
var oDialog = G('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 + this.info.shadowWidth;
oShadow['style']['left'] = oDialog.offsetLeft + this.info.shadowWidth;
oShadow['style']['width'] = oDialog.offsetWidth;
oShadow['style']['height'] = oDialog.offsetHeight
},
middle: function(){
if (!this.config.isBackgroundCanClick)
G('dialogBoxBG').style.display = '';
var oDialog = G('dialogBox');
oDialog['style']['position'] = "absolute";
oDialog['style']['display'] = '';
//取u24471 页u-26782 的u23485 度u21644 高u24230
var sClientWidth = document.body.clientWidth;
var sClientHeight = document.body.clientHeight;
var sScrollTop = document.body.scrollTop;
//
var sleft = (sClientWidth / 2) - (oDialog.offsetWidth / 2);
var iTop = -80 + (sClientHeight / 2 + sScrollTop) - (oDialog.offsetHeight / 2);
var sTop = iTop > 0 ? iTop : (sClientHeight / 2 + sScrollTop) - (oDialog.offsetHeight / 2);
if (sTop < 1)
sTop = "20";
if (sleft < 1)
sleft = "20";
oDialog['style']['left'] = sleft + "px"; //左u20391 位u32622
oDialog['style']['top'] = sTop + "px" //顶u-28440 位u32622
},
reset: function(){
if (this.config.isReloadOnClose) {
top.location.reload()
};
this.close()
},
close: function(){
G('dialogBox').style.display = 'none';
if (!this.config.isBackgroundCanClick)
G('dialogBoxBG').style.display = 'none';
if (this.config.isShowShadow)
G('dialogBoxShadow').style.display = 'none';
G('dialogBody').innerHTML = '';
this.showSome()
},
hiddenSome: function(){
var tag = this.info.someHiddenTag.split(",");
if (tag.length == 1 && tag[0] == "")
tag.length = 0;
for (var i = 0; i < tag.length; i++) {
this.hiddenTag(tag[i])
};
var ids = this.info.someHiddenEle.split(",");
if (ids.length == 1 && ids[0] == "")
ids.length = 0;
for (var i = 0; i < ids.length; i++) {
this.hiddenEle(ids[i])
};
var ids = this.info.someDisabledBtn.split(",");
if (ids.length == 1 && ids[0] == "")
ids.length = 0;
for (var i = 0; i < ids.length; i++) {
this.disabledBtn(ids[i])
};
space("begin")
},
disabledBtn: function(id){
var ele = document.getElementById(id);
if (typeof(ele) != "undefined" && ele != null && ele.disabled == false) {
ele.disabled = true;
this.someToDisabled.push(ele)
}
},
hiddenTag: function(tagName){
var ele = document.getElementsByTagName(tagName);
if (ele != null) {
for (var i = 0; i < ele.length; i++) {
if (ele[i].style.display != "none" && ele[i].style.visibility != 'hidden') {
ele[i].style.visibility = 'hidden';
this.someToHidden.push(ele[i])
}
}
}
},
hiddenEle: function(id){
var ele = document.getElementById(id);
if (typeof(ele) != "undefined" && ele != null) {
ele.style.visibility = 'hidden';
this.someToHidden.push(ele)
}
},
showSome: function(){
for (var i = 0; i < this.someToHidden.length; i++) {
this.someToHidden[i].style.visibility = 'visible'
};
for (var i = 0; i < this.someToDisabled.length; i++) {
this.someToDisabled[i].disabled = false
};
space("end")
}
};
var Dragdrop = new Class();
Dragdrop.prototype = {
initialize: function(width, height, shadowWidth, showShadow, contentType){
this.dragData = null;
this.dragDataIn = null;
this.backData = null;
this.width = width;
this.height = height;
this.shadowWidth = shadowWidth;
this.showShadow = showShadow;
this.contentType = contentType;
this.IsDraging = false;
this.oObj = G('dialogBox');
Event.observe(G('dialogBoxTitle'), "mousedown", this.moveStart.bindAsEventListener(this), false)
},
moveStart: function(event){
this.IsDraging = true;
if (this.contentType == 1) {
G("iframeBG").style.display = "";
G("iframeBG").style.width = this.width;
G("iframeBG").style.height = this.height
};
Event.observe(document, "mousemove", this.mousemove.bindAsEventListener(this), false);
Event.observe(document, "mouseup", this.mouseup.bindAsEventListener(this), false);
Event.observe(document, "selectstart", this.returnFalse, false);
this.dragData = {
x: Event.pointerX(event),
y: Event.pointerY(event)
};
this.backData = {
x: parseInt(this.oObj.style.left),
y: parseInt(this.oObj.style.top)
}
},
mousemove: function(event){
if (!this.IsDraging)
return;
var iLeft = Event.pointerX(event) - this.dragData["x"] + parseInt(this.oObj.style.left);
var iTop = Event.pointerY(event) - this.dragData["y"] + parseInt(this.oObj.style.top);
if (this.dragData["y"] < parseInt(this.oObj.style.top))
iTop = iTop - 12;
else
if (this.dragData["y"] > parseInt(this.oObj.style.top) + 25)
iTop = iTop + 12;
this.oObj.style.left = iLeft;
this.oObj.style.top = iTop;
if (this.showShadow) {
G('dialogBoxShadow').style.left = iLeft + this.shadowWidth;
G('dialogBoxShadow').style.top = iTop + this.shadowWidth
};
this.dragData = {
x: Event.pointerX(event),
y: Event.pointerY(event)
};
document.body.style.cursor = "move"
},
mouseup: function(event){
if (!this.IsDraging)
return;
if (this.contentType == 1)
G("iframeBG").style.display = "none";
document.onmousemove = null;
document.onmouseup = null;
var mousX = Event.pointerX(event) - (document.documentElement.scrollLeft || document.body.scrollLeft);
var mousY = Event.pointerY(event) - (document.documentElement.scrollTop || document.body.scrollTop);
if (mousX < 1 || mousY < 1 || mousX > document.body.clientWidth || mousY > document.body.clientHeight) {
this.oObj.style.left = this.backData["x"];
this.oObj.style.top = this.backData["y"];
if (this.showShadow) {
G('dialogBoxShadow').style.left = this.backData.x + this.shadowWidth;
G('dialogBoxShadow').style.top = this.backData.y + this.shadowWidth
}
};
this.IsDraging = false;
document.body.style.cursor = "";
Event.stopObserving(document, "selectstart", this.returnFalse, false)
},
returnFalse: function(){
return false
}
};
/*****************Popup.js ****end*******************/
</Script>
<INPUT TYPE="button" value="ShowHtmlString()" onclick="ShowHtmlString();">
<br>
<INPUT TYPE="button" value="ShowIframe()" onclick="ShowIframe();">
<br>
<INPUT TYPE="button" value="ShowAlert()" onclick="ShowAlert();">
<br>
<INPUT TYPE="button" value="ShowConfirm()" onclick="ShowConfirm();">
</BODY>
</HTML>
评论
4 楼
iwwenbo
2014-07-11
别逗好不好
3 楼
bugnuke
2012-08-23
尼玛 跑不了。。。
2 楼
showzh
2011-09-19
可惜没有具体的说明popup 的属性和方法的详细介绍
1 楼
ibio
2009-02-14
很强大!~你这篇文章还可真长呀。哈哈!~
顶一个先!~
顶一个先!~
发表评论
-
table 原来还可以这样用啊
2008-10-24 10:03 3002因为页面的需要,要对table的每一列进行显示和隐藏 ... -
Css+Div布局学习(五)—overflow属性
2008-09-22 11:34 1783overflow属性定义了当子元素超越了包含它的元素时,子元素 ... -
Css+Div布局学习(四)—关于hack
2008-09-22 11:32 1315并不是每一个浏览器都 ... -
Css+Div布局学习(三)—定位Position
2008-09-22 11:25 3256所有的框模型一开始都是按文档中正常的元素流定位,而定位posi ... -
Css+Div布局学习(二)—清理Clear
2008-09-22 11:23 1324我们在Css+Div布局学习(一)—Div布局基础这篇文章里面 ... -
Css+Div布局学习(一)—Div布局基础
2008-09-22 11:22 1981如果我们要进行Css的布局,那float(浮动)就是最为关键的 ... -
网页设计配色应用实例剖析——蓝色系
2008-09-18 21:17 1579蓝 色是色彩中比较沉静的颜色。象征着永恒与深邃、高远与博大、 ... -
网页设计配色应用实例剖析——橙色系
2008-09-18 21:10 965橙色 具有轻快、欢欣、收获、温馨、时尚的效果,是快乐、喜悦、能 ... -
网页设计配色应用实例剖析——黄色系
2008-09-18 21:10 1402黄 色是阳光的色彩,具有活泼与轻快的特点,给人十分年轻的感觉。 ... -
ajax技术原理及工作原理
2008-09-16 14:27 2234AJAX全称为“Asynchronous JavaScript ... -
37个Ajax和CSS实现的Tab选项卡切换效果界面
2008-09-16 14:24 2141在过去几年中,Web开发人员开发了许多Ajax和CSS,Tab ... -
IE和火狐的css兼容性问题归总
2008-09-11 11:01 2439IE和火狐的css兼容性问题归总 CSS对浏览器器的兼容 ... -
一个TAB效果
2008-09-09 14:42 986<!DOCTYPE html PUBLIC " ... -
JavaScript最常用的55个经典技巧
2008-09-09 09:37 12791. oncontextmenu="window.e ... -
JavaScript判断浏览器类型及版本
2008-09-08 10:42 1388你知道世界上有多少种浏览器吗?除了我们熟知的IE, Fir ... -
JS大全
2008-09-05 09:37 1338avascript小技巧 事件源对象 event.srcE ...
相关推荐
Popup.js 是一个专门为Web开发设计的JavaScript库,专注于创建弹出窗口功能。它以其灵活性和可扩展性而受到赞誉,是Web开发者实现交互式用户体验的一个重要工具。在本篇文章中,我们将深入探讨Popup.js的核心特性、...
5. **关闭逻辑**:`popup.js`可能设置了一个延迟关闭的机制,或者允许用户通过点击弹窗外的区域或按下Esc键来关闭弹窗。 6. **事件委托**:为了优化性能和减少事件监听器的数量,`popup.js`可能使用事件委托来处理...
Popup.js是百度开发的一个轻量级的弹出框插件,尤其适合在Web应用中创建可拖拽的小窗口。这个框架的进化版不仅保持了原有的功能,还优化了性能和用户体验,同时增加了对多种浏览器的兼容性,包括较老版本的Internet ...
在Web开发中,模态窗口(Modal Window)是一种常见的交互设计元素,它可以在用户与主页面交互时弹出一个遮罩层,使得用户必须处理完弹出的内容后才能继续操作主页面。在JavaScript库中,jQuery以其简洁的API和广泛的...
总的来说,jQuery popup javascript弹出窗口的实现涉及到JavaScript编程、CSS样式设计、事件处理、浏览器兼容性优化等多个方面,是一个综合性的网页开发任务。通过研究提供的文件,可以深入理解这些技术的结合应用。
popup.js是一款使用jQuery和CSS3制作并可以使用鼠标进行互动的3D弹出窗口插件。该3D弹出窗口插件使用简单,并且在旧的浏览器中会回退为非3D状态,兼容IE8+的所有现代浏览器。
"popup.js+popupclass.js"的标题和描述暗示了我们讨论的是两个与弹出窗口相关的JavaScript文件。在网页应用中,弹出窗口通常用于显示通知、设置、用户交互等内容,提升用户体验。 首先,`popup.js`很可能是一个包含...
这个库的核心特性包括响应式布局、触摸设备支持、平滑过渡效果和自定义选项,使得开发者可以轻松地调整弹出窗口的外观和行为。 1. **magnific-popup.js的使用**: - 引入库:首先需要在HTML文件中引入magnific-...
JavaScript(JS)是网页开发中的重要脚本语言,它可以动态地改变网页内容和行为,包括创建和控制`popup`弹出框。在JS中,我们可以使用`window.alert()`, `window.confirm()`, 和 `window.prompt()`三种内置函数来...
百度Popup.js是一款用于创建弹出窗口和拖拽效果的JavaScript库,它的主要特点是代码精简且效果良好。在本篇文章中,我们将详细讨论该弹出框进化版的功能、兼容性以及如何处理在不同浏览器中的兼容性问题。同时,我们...
首先,popup.js的核心是利用jQuery库的事件处理和DOM操作能力,通过简单的API调用来创建和管理弹出窗口。jQuery作为一个强大的JavaScript库,简化了DOM操作,使得开发者无需关注浏览器之间的差异,可以专注于功能的...
Jquery.popup.js 适用于您的应用程序的模态和弹出窗口。 支持animate.css。 默认包括js / jquery.popup.min.js 和最新的jQuery入门[removed][removed][removed][removed]正在安装使用的默认值: $('#elem').popup();...
"Popup例子 实现弹出窗口的关闭"这个主题聚焦于如何在WP应用中设计并实现一个功能完善的弹出窗口(Popup),并且允许用户通过点击弹出窗口外部的任何地方来关闭它。下面我们将详细探讨这一技术。 首先,Popup是...
标题中提到的“百度popup.js 完美修正版”指的是百度开发的一段JavaScript脚本代码,这个脚本被广泛应用于实现弹出窗口和拖拽效果,非常适合用于网页设计和开发中。脚本之家作为一个推荐和分享脚本资源的网站,推荐...
本篇将详细讲解如何使用ArcGIS API 实现多个弹窗(Popup)的弹出功能,这对于展示地图上的详细信息、提供用户交互体验至关重要。 首先,ArcGIS API 提供了Popup类,用于在地图上创建弹窗。Popup对象可以包含图层的...
### JavaScript弹出窗口DIV层效果代码详解 在现代网页设计中,弹出窗口或模态框(Modal)是一种常见的交互模式,用于展示额外的信息、表单或其他内容,而不需重新加载整个页面。本文将深入解析如何使用纯JavaScript...
在JavaScript编程中,"popup_element.js:小js对象创建模式弹出窗口" 主要涉及到的是使用JavaScript对象创建模式来设计和实现一个弹出窗口的功能。这个弹出窗口可能用于显示通知、用户交互或者提供额外的信息。...
在这里,我们将深入探讨JavaScript弹出窗口的原理、实现方式以及可能涉及到的`popup.js`和`PopupsUtil.js`这两个文件的角色。 首先,JavaScript弹出窗口通常通过以下几种方式创建: 1. `window.alert()`: 这个函数...