- 浏览: 166522 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
crabboy:
goodhttp://veerle.duoh.com/comm ...
表格效果 -
lunvsxiao:
好呀,省的自己记那么多了。。
java常用正则表达式
消息提示封装js
/** ---------------------------------------------------------------------------- var pop = new popWindow({id:"netSpeed",width:250,height:150,caption:"网速提示",title:"加载当前页面用时",message:time+"ms"}); pop.show(); ---------------------------------------------------------------------------- /**//* * 消息构造 */ var popWindow = function(arg){ this.id = (typeof arg.id == "undefined") ?"popTemp":arg.id; this.title = (typeof arg.title == "undefined") ?"内容如下":arg.title; this.caption= (typeof arg.caption == "undefined") ?"消息提示":arg.caption; this.message= (typeof arg.message == "undefined") ?" ":arg.message; this.target = (typeof arg.target == "undefined") ?" ":arg.target; this.action = (typeof arg.action == "undefined") ?" ":arg.action; this.width = (typeof arg.width == "undefined") ?250:arg.width; this.height = (typeof arg.height == "undefined") ?150:arg.height; this.speed = 20; this.step = 1; this.right = screen.width -1; this.bottom = screen.height; this.left = this.right - this.width; this.top = this.bottom - this.height; this.timer = 0; this.stayTimer= 0; this.pause = false; this.close = false; this.stay = (typeof arg.stay == "undefined") ?3:arg.stay;//默认设置为三秒 this.autoHide = (typeof arg.autoHide == "undefined") ?true:arg.autoHide; } /**//* * 隐藏消息方法 */ popWindow.prototype.hide = function(){ if(this.onunload()){ var offset = this.height>this.bottom-this.top?this.height:this.bottom-this.top; var me = this; if(this.timer>0){ window.clearInterval(me.timer); } if(this.stayTimer>0){ window.clearTimeout(me.stayTimer); } var fun = function(){ if(me.pause==false||me.close){ var x = me.left; var y = 0; var width = me.width; var height = 0; if(me.offset>0){ height = me.offset; } y = me.bottom - height; if(y>=me.bottom){ window.clearInterval(me.timer); me.Pop.hide(); } else { me.offset = me.offset - me.step; } me.Pop.show(x,y,width,height); } } this.timer = window.setInterval(fun,this.speed); } } /** * 消息卸载事件 */ popWindow.prototype.onunload = function() { return true; } /** * 消息命令事件 */ popWindow.prototype.oncommand = function(){ //this.close = true; this.hide(); window.open("http://wangsuceshi.hao352.com/"); } /** * 消息显示方法 */ popWindow.prototype.show = function(){ var oPopup = window.createPopup(); //IE5.5+ this.Pop = oPopup; var w = this.width; var h = this.height; var str = "<div style=\"width:250px;height:145px;margin:0 auto;background:url(images/box_bg.gif) no-repeat;padding:4px 0 0 4px;position:relative;\">" + " <div style=\"background:url(images/box_top.png) no-repeat;height:23px;;\">" + " <h2 style=\"padding-left:16px;width:100px;float:left\"></h2>" + " <div title=关闭 style=\"background-image:url(images/box_close1.png); width:23px; height:22px; cursor:pointer; float:right; z-index:1; margin-right:7px;\" id=\"btSysClose\"onmouseover=\"this.style.backgroundImage='url(images/box_close2.png)';\" onmouseout=\"this.style.backgroundImage='url(images/box_close1.png)';\"></div>" + " </div>" + " <div style=\"width:240px;\">" + " <div class=\"notic\">" + " <div class=\"text\" style=\"padding:6px 5px 6px 5px;text-indent:2em;line-height:138%;height:90px;color:#000000;cursor:pointer;overflow-y:auto;font-size:12px;\">" + this.title + ":" + "<a href=\"#none\" id='btCommand' style=\"text-decoration: none; color:#000;\" onmouseover=\"this.style.color='#f60'\" onmouseout=\"this.style.color='#000'\">" + this.message + "</a>" + " </div>" + " </div>" + " </div>" + "</div>"; oPopup.document.body.innerHTML = str; this.offset = 0; var me = this; oPopup.document.body.onmouseover = function(){me.pause=true;} oPopup.document.body.onmouseout = function(){me.pause=false;} var fun = function(){ var x = me.left; var y = 0; var width = me.width; var height = me.height; if(me.offset>me.height){ height = me.height; } else { height = me.offset; } y = me.bottom - me.offset; if(y<=me.top){ window.clearInterval(me.timer); if(me.autoHide){ me.stayTimer = window.setTimeout(function(){me.hide()},me.stay*1000); } } else { me.offset = me.offset + me.step; } me.Pop.show(x,y,width,height); } this.timer = window.setInterval(fun,this.speed); var btClose = oPopup.document.getElementById("btSysClose"); btClose.onclick = function(){ me.close = true; me.hide(); } var btCommand = oPopup.document.getElementById("btCommand"); btCommand.onclick = function(){ me.oncommand(); } } /** ** 设置速度方法 **/ popWindow.prototype.speed = function(s){ var t = 20; try { t = praseInt(s); } catch(e){} this.speed = t; } /** ** 设置步长方法 **/ popWindow.prototype.step = function(s){ var t = 1; try { t = praseInt(s); } catch(e){} this.step = t; } popWindow.prototype.rect = function(left,right,top,bottom){ try { this.left = left !=null?left:this.right-this.width; this.right = right !=null?right:this.left +this.width; this.bottom = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height; this.top = top !=null?top:this.bottom - this.height; } catch(e){} } function showMsg(time){ var pop = new popWindow({id:"netSpeed"+time,width:250,height:150,caption:"网速提示",title:"加载当前页面用时",message:time+"ms",autoHide:true,stay:4}); pop.rect(null,null,null,screen.height-50); pop.speed = 10; pop.step = 5; pop.show(); } /** var pop = new popWindow({id:"netSpeed",width:250,height:150,caption:"网速提示",title:"加载当前页面用时",message:"1ms"}); pop.rect(null,null,null,screen.height-50); pop.speed = 10; pop.step = 5; pop.show(); */ /** var pop2 = new popWindow({id:"netSpeed",width:250,height:150,caption:"网速提示",title:"加载当前页面用时",message:"2ms"}); pop2.rect(100,null,null,screen.height); pop2.show(); */
- popWindow.rar (2.1 KB)
- 下载次数: 7
发表评论
-
js event.keyCode
2011-12-02 17:13 674keycode 8 = BackSpace BackSpace ... -
js event.keyCode
2011-12-02 17:06 2keycode 8 = BackSpace BackSpace ... -
IE6下png透明处理心得
2011-11-24 12:41 1264首先说明一下,网上处理IE6下png透明的方法有很多,但无外乎 ... -
不使用中间变量,交换int型的 a, b两个变量的值
2011-02-22 18:08 720(function(){ var a = 10, b ... -
dom加载完的判断
2011-02-12 18:05 2976window.onload事件可以安全的执行javascr ... -
js节点操作
2011-02-11 16:14 796insertAdjacentElement方法 语法: ... -
[JS]URLParser-html页面参数获取类
2010-10-11 09:05 652URLParser类代码 /* @class: ... -
JS函数库 common.js
2010-09-20 15:55 1102/****************************** ... -
简单的加解密
2010-09-12 20:51 610前段时间看到flash中写的一段混淆代码,现记录下,以备后用。 ... -
js排序
2010-09-02 16:37 751<html> <body> ... -
日期的格式化函数(转)
2010-08-17 15:38 634//Date.prototype.isLeapYe ... -
动态加载JS脚本的4种方法
2010-08-05 11:55 502动态加载JS脚本的4种方法 要 ... -
关于table等只读标签的innerHTML问题
2010-04-26 17:58 1685function setTbodyHTML(id,tr){ ... -
[转载]100多个很有用的JavaScript函数以及基础写法大集合
2010-04-24 23:17 11581.document.write(""); ... -
网页高亮显示文字
2010-04-15 15:24 1912function hightLight(str,style,f ... -
遍历JSON
2010-04-11 15:11 1550<!DOCTYPE html PUBLIC " ... -
霓虹灯效果
2010-04-09 11:09 1305<!DOCTYPE html PUBLIC &qu ... -
JavaScript 的事件冒泡 demo
2010-03-15 10:11 1210转载: 如果你还不理解JavaScript的事件冒泡往下看: ... -
获得页面的高度(转载)
2010-02-03 21:50 1265function getDocHeight(doc){ / ... -
JS读取并输出xml文件节点及属性
2010-01-19 17:42 2068book.html 代码如下: ++++++++++++ ...
相关推荐
Cesium气泡信息提示框,在地图上点击一个点图标,弹出一个信息提示框,可以跟随图表一起移动。
qml 自定义 信息提示框 消息提示框 可以根据信息的多少大小自动调整
自制前端信息提示框支持自定义标题,背景色,按钮个数,样式等。
易语言模块信息提示框控件(Tip).rar 易语言模块信息提示框控件(Tip).rar 易语言模块信息提示框控件(Tip).rar 易语言模块信息提示框控件(Tip).rar 易语言模块信息提示框控件(Tip).rar 易语言模块信息提示框控件...
javascript+css 实现QQ空间信息提示框
VB 编制 信息提示框 类似与QQ信息提示框 核心源码来自于CSDN高人
qq信息提示框,希望对象学习的人有帮助。
通常网页上用的透明信息提示框,是javascript来实现透明信息提示框(tooltip)
易语言源码信息提示框控件(Tip).7z
用vb开发的信息提示框,界面漂亮。更多选择,有终止、重试、取消、确定。有源码。
ATMHud信息提示框
一个简单的安卓提示框,弹出具体信息提示框;使用AlertDialog.Builder写的提示信息框
clueTip简单实用的信息提示框 clueTip简单实用的信息提示框 clueTip简单实用的信息提示框 clueTip简单实用的信息提示框 clueTip简单实用的信息提示框
vb仿qq的右下角信息提示框源码 vb提示框
Jquery提示框插件制作用户名片信息提示框代码
arcgis api for js 自定义弹出信息提示框,可以根据自己需要直接修改css样式即可。
鼠标移上去显示一个信息提示框,支持自定义样式。类似悬停提示的效果,简单易用,很好使用, 这是完整的资源,下载完后直接用浏览器打开即可。
JS 动态生成一个下载详细信息提示框,鼠标移动到下载按钮上边会自动显示一个下载信息的提示框。
使用javascript实现可随屏幕滚动移动的信息提示框。
12款超酷HTML5信息提示框特效是一款精美的网站信息提示特效下载。