java消息提示代码_JAVA中实现消息提示功能代码 .
注(在MyEclipse中新建一个jsp文件然后把代码复制到当中即可!)
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
MSN 弹出消息框
function MessShow(id,width,height,caption,title,message,target,action)
{
this.id = id;
this.title = title;
this.caption = caption;
this.message = message;
this.target = target;
this.action = action;
this.width = width?width:250;
this.height = height?height:150;
this.timeout = 250; //消息停留时间
this.speed = 10; //消息速度,越小越快
this.step = 2; //移动步长
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.pause = false;
this.close = false;
this.autoHide = true;
}
MessShow.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);
}
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)
}
}
//消息卸载事件,可以重写
MessShow.prototype.onunload = function()
{
return true;
}
// 消息命令事件,要实现自己的连接,请重写它
MessShow.prototype.oncommand = function()
{
window.open(this.action,this.target);
this.hide();
}
// 消息显示方法
MessShow.prototype.show = function()
{
var oPopup = window.createPopup(); //IE5.5+
this.Pop = oPopup;
var w = this.width;
var h = this.height;
var str = "
str += "
str += "
"
str += "
∵"
str += "
" + this.caption + ""
str += "
"
str += "×
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
str += "
"
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)
{
me.timeout--;
if(me.timeout==0)
{
window.clearInterval(me.timer);
if(me.autoHide)
{
me.hide();
}
}
}
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();
}
}
// 设置速度方法
MessShow.prototype.speed = function(s)
{
var t = 10;
try
{
t = praseInt(s);
}
catch(e){}
this.speed = t;
}
// 设置步长方法
MessShow.prototype.step = function(s)
{
var t = 2;
try
{
t = praseInt(s);
}
catch(e){}
this.step = t;
}
MessShow.prototype.rect = function(left,right,top,bottom)
{
try
{
this.left = left?left:0;
this.right = right?right:screen.availWidth -1;
this.top = top?top:0;
this.bottom = bottom?bottom:screen.availHeight;
}
catch(e)
{}
}
function load()
{
var msg = new MessShow("hello",250,150,"信息","小美,你好!","QQ:******* 请求加你为好友!","_bank",'http://www.baidu.com');
msg.show();
}
java消息提示代码_JAVA中实现消息提示功能代码 .相关推荐
- java 生成对称密钥_Java中创建对称密钥的代码
1 加密 public static byte[] jiami() throws Exception { //密钥生成器 KeyGenerator key=KeyGenerator.getInstan ...
- Java成员变量查找_Java中的成员变量和局部变量
声明成员变量 可以用public proteced private修饰 eg public class Apple{ public String color;//声明公共变量 public stat ...
- Wordpress模板主题中functions.php常用功能代码与常用插件[ 后台篇](持续收集整理)
用Wordpress建站的初学者一定会需要用到的Wordpress模板主题中functions.php常用功能代码与常用插件.慢慢持续收集整理....... 目录 一.Wordpress模板主题中fu ...
- java socket 推送机制_Java中websocket消息推送的实现代码
一.服务层 package com.demo.websocket; import java.io.IOException; import java.util.Iterator; import java ...
- java调c++代码_Java中调用C++代码的实现 | 学步园
JNI为 Java Native Interface 即Java本地接口,使用此种方式可以对C/C++代码进行调用,其在本质上是对C/C++生成的动态库进行调用而不是直接对C/C++代码进行调用 J ...
- java 如何忽略异常_java中如何解决异常
原文 | dzone.com/articles/9-- 作者 | Thorben Janssen 翻译 | geekymv 无论你是初学者还是经验丰富的开发人员,对于你和你的团队来说,提高异常处理的能 ...
- java 接口 安全加密_Java中的安全加密
java 接口 安全加密 上一次我写关于密码学的文章时 ,我概述了Apache Shiro加密API,并展示了如何使用其两个对称密码. 我还写道:"您不需要在应用程序中加密和解密敏感数据的更 ...
- java构建xml参数_Java中使用XML创建EMAIL模板
邮件模板 让我们来看看邮件模板的格式.模板是XML文件,它包含一个根元素和一系列根的子元素.根元素是.必要的子元素是, , 和 .可选的子元素是 , , 和 .如果你使用过邮件系统,那么你可以推导出这 ...
- java 异常处理发生异常_Java中的异常处理
java 异常处理发生异常 Exception Handling in Java is a very interesting topic. Exception is an error event th ...
最新文章
- Oracle 客户端 使用 expdp/impdp 示例 说明
- Nginx教程-location配置
- c#split方法拆分为数据_【转载】C#使用Split函数根据特定分隔符分割字符串
- LayaAir学习笔记
- 史上最强三千六百道脑筋急转弯(3)
- SCJP 认证考试指南
- linux内核各版本的下载路径
- Matlab仿真两种方法求圆周率π
- 西瓜创客的python_西瓜创客Python客户端
- Java IO与NIO的区别
- Linux常用命令 shell脚本for QA-数据脱敏版2
- 实验五 CA的安装和使用
- Insecure CAPTCHA(不安全的验证码)
- 达摩院命名实体识别及其在阿里小蜜的应用(v2020-05-11)
- C#长链接转短链接(调用新浪api)
- 民间秘术——各类求仙方法
- 从线下棋牌室到棋牌游戏开发平台 棋牌游戏行业发生了太多变化
- zabbix_server表面启动成功,但是没有进程
- l2高斯分布_L1正则先验是Laplace分布,L2正则先验分布是高斯分布
- mysql where 位子,mysql中 地里位置搜索 (抄)