模仿QQ弹出窗口的源代码(推荐)
2007-02-25 14:56
295 查看
<html>
<!--把下列代码加到head区域内-->
<head>
<SCRIPT language=javascript>
//more javascript from http://www.webjx.com
window.onload = enetgetMsg;
window.onresize = enetresizeDiv;
window.onerror = function(){
}
var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
function enetgetMsg(){
try{
enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10);
enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10);
enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10);
enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10);
enetdocWidth = document.body.clientWidth;
enetdocHeight = document.body.clientHeight;
// enetdivHeight
document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;
document.getElementById("enetMeng").style.left =
parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth;
document.getElementById("enetMeng").style.visibility="visible";
enetobjTimer = window.setInterval("enetmoveDiv()",10);
}
catch(e){
}
}
function enetresizeDiv(){
i+=1;
if(i>600){
enetcloseDiv()
}
try{
enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10);
enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10);
enetdocWidth = document.body.clientWidth;
enetdocHeight = document.body.clientHeight;
document.getElementById("enetMeng").style.top =
enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10);
document.getElementById("enetMeng").style.left =
enetdocWidth - enetdivWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){
}
}
function enetmoveDiv(){
try{
if(parseInt(document.getElementById("enetMeng").style.top,10) <=
(enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10))){
window.clearInterval(enetobjTimer);
enetobjTimer = window.setInterval("enetresizeDiv()",1);
}
enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10);
document.getElementById("enetMeng").style.top = enetdivTop - 1;
}
catch(e){
}
}
function enetcloseDiv(){
document.getElementById('enetMeng').style.visibility='hidden';
if(enetobjTimer){
window.clearInterval(enetobjTimer);
}
}
</SCRIPT>
</head>
<body>
<!--把下列代码加到BODY区域内-->
<DIV id=enetMeng
style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid;
Z-INDEX: 99999; LEFT: 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid;
WIDTH: 241px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: -200px; HEIGHT: 157px">
<TABLE WIDTH=255 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#DAE6FC">
<TR>
<TD height="30" valign="top" background="qqimages/heihei_1.jpg">
<table width="255" height="19" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="212" valign="bottom">
<strong><font color="#FF6600" size="2">消息框</font></strong>
</td>
<td width="10" style="cursor:hand" onClick="enetcloseDiv()">
close
</td>
</tr>
</table>
</TD>
</TR>
<TR>
<TD height="122" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="1">
<table align="center" width="98%">
<tr>
<td>
欢迎你来到网页教学网http://www.webjx.com
</td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</DIV>
</body>
</html>
<!--把下列代码加到head区域内-->
<head>
<SCRIPT language=javascript>
//more javascript from http://www.webjx.com
window.onload = enetgetMsg;
window.onresize = enetresizeDiv;
window.onerror = function(){
}
var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
function enetgetMsg(){
try{
enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10);
enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10);
enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10);
enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10);
enetdocWidth = document.body.clientWidth;
enetdocHeight = document.body.clientHeight;
// enetdivHeight
document.getElementById("enetMeng").style.top = parseInt(document.body.scrollTop,10) + enetdocHeight + 10;
document.getElementById("enetMeng").style.left =
parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth;
document.getElementById("enetMeng").style.visibility="visible";
enetobjTimer = window.setInterval("enetmoveDiv()",10);
}
catch(e){
}
}
function enetresizeDiv(){
i+=1;
if(i>600){
enetcloseDiv()
}
try{
enetdivHeight = parseInt(document.getElementById("enetMeng").offsetHeight,10);
enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10);
enetdocWidth = document.body.clientWidth;
enetdocHeight = document.body.clientHeight;
document.getElementById("enetMeng").style.top =
enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10);
document.getElementById("enetMeng").style.left =
enetdocWidth - enetdivWidth + parseInt(document.body.scrollLeft,10);
}
catch(e){
}
}
function enetmoveDiv(){
try{
if(parseInt(document.getElementById("enetMeng").style.top,10) <=
(enetdocHeight - enetdivHeight + parseInt(document.body.scrollTop,10))){
window.clearInterval(enetobjTimer);
enetobjTimer = window.setInterval("enetresizeDiv()",1);
}
enetdivTop = parseInt(document.getElementById("enetMeng").style.top,10);
document.getElementById("enetMeng").style.top = enetdivTop - 1;
}
catch(e){
}
}
function enetcloseDiv(){
document.getElementById('enetMeng').style.visibility='hidden';
if(enetobjTimer){
window.clearInterval(enetobjTimer);
}
}
</SCRIPT>
</head>
<body>
<!--把下列代码加到BODY区域内-->
<DIV id=enetMeng
style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid;
Z-INDEX: 99999; LEFT: 0px; VISIBILITY: visible; BORDER-LEFT: #a6b4cf 1px solid;
WIDTH: 241px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: -200px; HEIGHT: 157px">
<TABLE WIDTH=255 BORDER=0 CELLPADDING=0 CELLSPACING=0 bgcolor="#DAE6FC">
<TR>
<TD height="30" valign="top" background="qqimages/heihei_1.jpg">
<table width="255" height="19" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="212" valign="bottom">
<strong><font color="#FF6600" size="2">消息框</font></strong>
</td>
<td width="10" style="cursor:hand" onClick="enetcloseDiv()">
close
</td>
</tr>
</table>
</TD>
</TR>
<TR>
<TD height="122" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="1">
<table align="center" width="98%">
<tr>
<td>
欢迎你来到网页教学网http://www.webjx.com
</td>
</tr>
</table>
</TD>
</TR>
</TABLE>
</DIV>
</body>
</html>
相关文章推荐
- 源码推荐(02.22B):模仿QQ弹出视图,tableView和collectionView间转场动画
- 借鉴网上的winform模仿QQ窗口停靠功能稍作改动
- 用AS+JS实现IE等浏览器的强制弹出窗口源代码
- QQ消息窗口弹出思路
- 模仿快捷分享、从下往上弹出窗口,自定义分享菜单
- 源码推荐(03.01B):模仿tumblr的弹出菜单,编辑全选删除
- 网页弹出qq聊天窗口
- 如何查看弹出窗口的源代码
- js-javascript-鼠标悬停弹出大图窗口的源代码
- C#类似QQ的弹出消息窗口
- 弹出在线QQ窗口
- 源码推荐(9.21):模仿qq的小红点的动画,Swift (及Objective-C) 测试框架 -Quick
- 如何判断某个弹出窗口已经被打开及刷新 推荐
- 摘录的WinForm Control 开发5,WinForm 开发:TaskbarNotifierDemo ,类似qq弹出窗口
- 制作网页上点击后自动弹出QQ聊天窗口代码
- popupWin 属性及用法介绍 ASP.NET控件,仿QQ,msn右下角弹出窗口
- 仿QQ页面右侧底部弹出消息窗口
- js实现打开网页自动弹出添加QQ好友邀请窗口
- QQ弹出窗口
- Windows Phone 中的弹出窗口 推荐