站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Javascript 专题用javascript作消息提示框(类似于QQ用户上线的消息提

用javascript作消息提示框(类似于QQ用户上线的消息提

摘要: 用javascript作消息提示框(类似于QQ用户上线的消息提
<tr> <td>

在开发项目的时候,需要在有用户消息的时候提醒用户,刚好自己的QQ好友上线,QQ自动弹出一个消息提示,觉得不错。所以用javascript利用popup作了一个类似的功能。


<head>
HTMLPage1





</head>

<script language =javascript>
var titlePopup
var len;

function InitMsgBox()
{ len = 0;
titlePopup=window.createPopup();
var titlePopupBody = titlePopup.document.body;
titlePopupBody.style.border ="solid black 1px";
var titleContent = "";
titleContent = titleContent + "<table cellPadding='5' bgcolor='#65c1ff' width='100%' height='100%' border=0 cellspacing=0 cellpadding=0>";
titleContent = titleContent + "<tr><td align=center>消息提醒</td></tr>";
titleContent = titleContent + "<tr><td>内容</td></tr>";
titleContent = titleContent + "<tr><td>内容</td></tr>";
titleContent = titleContent + "<tr><td>日期</td></tr>";
titleContent = titleContent + "</table>";
titlePopupBody.innerHTML = titleContent;

ShowMsgBox();
}

function MsgBox()
{
len += 4;
if (len > 110)
{
window.clearInterval(tID);
}
else
{//170固定了消息提示框的宽度
titlePopup.show(document.body.clientWidth - 170, document.body.clientHeight - len, 170, len, top.document.body);
}
}

var tID
function ShowMsgBox()
{
tID = window.setInterval("MsgBox()",15);
}
</script>

<body MS_POSITIONING="GridLayout">
<input onclick="InitMsgBox()" id="Button1" style="Z-INDEX: 101; LEFT: 296px; POSITION: absolute; TOP: 344px" type="button"
</body>

<textarea class=fm id=code5 rows=12 cols=78> <head> HTMLPage1 </head> <script language =javascript> var titlePopup var len; function InitMsgBox() { len = 0; titlePopup=window.createPopup(); var titlePopupBody = titlePopup.document.body; titlePopupBody.style.border ="solid black 1px"; var titleContent = ""; titleContent = titleContent + "<table cellPadding='5' bgcolor='#65c1ff' width='100%' height='100%' border=0 cellspacing=0 cellpadding=0>"; titleContent = titleContent + "<tr><td align=center>消息提醒</td></tr>"; titleContent = titleContent + "<tr><td>内容</td></tr>"; titleContent = titleContent + "<tr><td>内容</td></tr>"; titleContent = titleContent + "<tr><td>日期</td></tr>"; titleContent = titleContent + "</table>"; titlePopupBody.innerHTML = titleContent; ShowMsgBox(); } function MsgBox() { len += 4; if (len > 110) { window.clearInterval(tID); } else {//170固定了消息提示框的宽度 titlePopup.show(document.body.clientWidth - 170, document.body.clientHeight - len, 170, len, top.document.body); } } var tID function ShowMsgBox() { tID = window.setInterval("MsgBox()",15); } </script> <body MS_POSITIONING="GridLayout"> <input onclick="InitMsgBox()" id="Button1" style="Z-INDEX: 101; LEFT: 296px; POSITION: absolute; TOP: 344px" type="button" value="Button" name="Button1"> </body> </textarea>

<input style="CURSOR: hand" onfocus=this.blur() onclick="runEx('code5')" type=button value=运行代码> <input style="WIDTH: 95px; CURSOR: hand" onfocus=this.blur() onclick=cycode(code5) type=button value=复制到剪贴板 name=Submit> <input style="CURSOR: hand" onfocus=this.blur() onclick=svcode(code5) type=button value=另存代码> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

</td> </tr> </table>
↑返回目录
前一篇: Javascript高级应用:文件操作篇
后一篇: XML+ JS创建树形菜单