代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
JS
】
仿 MSN网站首页弹出式欢迎词(兼容Firefox/IE)
作者:
李敬塔
/ 发布于
2012/12/5
/
653
<html><head> <script language="javascript"> /**** **createDate:2009-01-11 **author:李敬塔 *****/ var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,i = 0; var popupMessage = new Object(); popupMessage.id = 'popupMessage'; popupMessage.obj = function(){ return document.getElementById(popupMessage.id); }; popupMessage.onLoad = function(){ try{ divTop = parseInt(popupMessage.obj().style.top,10); divLeft = parseInt(popupMessage.obj().style.left,10); divHeight = parseInt(popupMessage.obj().offsetHeight,10); divWidth = parseInt(popupMessage.obj().offsetWidth,10); docWidth = document.body.clientWidth; docHeight = document.body.clientHeight; popupMessage.obj().style.top = parseInt(document.body.scrollTop,10) + docHeight + 10; popupMessage.obj().style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth; popupMessage.obj().style.visibility="visible"; popupMessage.timer = window.setInterval(popupMessage.move,2); } catch(e){} }; popupMessage.onResize = function(){ i+=1; if(i>1000) popupMessage.close(); try{ divHeight = parseInt(popupMessage.obj().offsetHeight,10); divWidth = parseInt(popupMessage.obj().offsetWidth,10); docWidth = document.body.clientWidth-1; docHeight = document.body.clientHeight-1; popupMessage.obj().style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10); popupMessage.obj().style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10); } catch(e){} }; popupMessage.move = function(){ try { if(parseInt(popupMessage.obj().style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))) { window.clearInterval(popupMessage.timer); popupMessage.timer = window.setInterval(popupMessage.onResize,1); } divTop = parseInt(popupMessage.obj().style.top,10); popupMessage.obj().style.top = divTop - 1; } catch(e){} }; popupMessage.close = function(){ if(popupMessage.obj()) popupMessage.obj().parentNode.removeChild(popupMessage.obj()); if(popupMessage.timer) window.clearInterval(popupMessage.timer); }; popupMessage.createInstance = function(bodyHtml){ try { if(popupMessage.obj())popupMessage.obj().parentNode.removeChild(popupMessage.obj()); if(popupMessage.timer) window.clearInterval(popupMessage.timer); i=0; var odiv = document.createElement('DIV'); odiv.id = popupMessage.id; odiv.style.background="#CFDEF4";odiv.style.border='solid 1px #3399FF'; odiv.style.width="199px"; odiv.style.height="auto"; odiv.style.visibility="hidden"; odiv.style.position="absolute"; odiv.style.zIndex="99999"; odiv.style.left="0px"; odiv.innerHTML = bodyHtml; document.body.appendChild(odiv); } catch(e){} }; window.onresize = popupMessage.onResize; function popupMessagePopup(bodyHtml) { popupMessage.createInstance(bodyHtml); popupMessage.onLoad(); } popupMessage.convertWin = function(){ var msg = document.getElementById('msgContent'); var contentdis = document.getElementById('btContent'); var flg = msg.style.display=="none"; if(flg) { contentdis.innerHTML = '—'; contentdis.title='最小化窗口'; msg.style.display = "block"; } else { contentdis.innerHTML = '□'; contentdis.title='最大化窗口'; msg.style.display = "none"; } } function myPopup(msgstr) { var divstr="<div style=\"width:198px;height:auto;background-color:#CFDEF4;font-size:12px;border:solid 1px #3399FF;\">"; divstr+="<div style=\"width:100%;height:auto;float:left;\">"; divstr+="<span style=\"width:130px;float:left;text-align:left;text-indent:8px;padding:4px;color:#0C53C5;\">消息提示</span>"; divstr+="<span title=\"关闭\" style=\"width:15px;border-width:0px;float:right;margin- right:5px;padding:4px;" +"color:Red; cursor:pointer;font-weight:bold;\" onclick=\"popupMessage.close();return false;\">×</span>"; divstr+="<span id=\"btContent\" title=\"最小化窗口\" style=\"width:15px;border-width:0px;" +"float:right;padding:4px; margin-right:7px;color:Red;cursor:pointer;font-weight:bold;\"" + " onclick=\"popupMessage.convertWin();\">—</span></div>"; divstr+="<div id=\"msgContent\" style=\"width:100%;overflow:hidden;height:60px;line-height:60px;float:left;WORD-BREAK:break-all;" +"border-top:solid 1px #3399FF;text-align:left; text-indent:10px;\">" +"<span style=\"font-size:16px; padding:8px; color:Red; \">"+msgstr+"</span></div></div>"; popupMessagePopup(divstr); } </script> </head> <body> <input type="button" value="test" onClick="myPopup('你的好友 我我我上线了');"> </body> </html>
试试其它关键字
MSN网站
同语言下
.
Jquery搜索框获取回车事件
.
H5页面添加倒计时,然后自动跳转
.
通过user-agent判断h5页面是在哪个手机App(QQ、微信
.
nginx 禁止未绑定的域名访问
.
JavaScript 获取按键,并屏蔽系统 Window 事件
.
H5之只允许微信浏览器打开,禁止从外部浏览器访问
.
微信打开网址添加在浏览器中打开提示的办法
.
实现JS复制、粘贴,Chrome/Firefox下可用
.
video视频播放,play()、pause()、duration时长、onen
.
HTML5实现MP3上传前的预览和播放时长的获取
可能有用的
.
C#实现的html内容截取
.
List 切割成几份 工具类
.
SQL查询 多列合并成一行用逗号隔开
.
一行一行读取txt的内容
.
C#动态修改文件夹名称(FSO实现,不移动文件)
.
c# 移动文件或文件夹
.
c#图片添加水印
.
Java PDF转换成图片并输出给前台展示
.
网站后台修改图片尺寸代码
.
处理大图片在缩略图时的展示
李敬塔
贡献的其它代码
(
13
)
.
PHP模拟登录获取邮箱联系人地址
.
HTML节点交换(兼容FF/IE)
.
js数组分页
.
兼容FF的右键菜单
.
实现textarea内字符串选择查询替换功能
.
SQL的形式操作文件
.
可以传对像的setTimeout函数
.
音频播放器
.
仿 MSN网站首页弹出式欢迎词(兼容Firefox/IE)
.
支持IE、FF纯js 颜色选择器
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3