また、チャイナユニコムの IOM プロジェクトに取り組んでいるときに、30 分ごとにページにプロンプト メッセージをポップアップ表示する必要があるという要件にも遭遇しました (メッセージは QQ ニュースに似た形式で表示されます)。当時ネットでそのような情報を見つけたのですが、原文の出典が思い出せません コードをコピー コードは次のとおりです: JavaScript のヒント <br><!-- <br><br>/**<BR>* クラス名: CLASS_MSN_MESSAGE <BR>* 機能: MSN のようなメッセージ ボックスを提供します <BR>* 例: <BR>* var MSG = new CLASS_MSN_MESSAGE("aa",200,120,"ショート メッセージ プロンプト:","メッセージが 1 件あります", "今日ディナーに招待してください"); <BR>* MSG.show(); <BR>* メッセージ構造<BR>*/ <BR>function CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){ <BR>これ。 ID = ID; <BR>this.title = タイトル; <BR>this.caption = キャプション; <BR>this.message = メッセージ; <BR>this.target = ターゲット; <BR>this.action = アクション; <BR>this.width = width?width:200; <BR>this.height = height?height:120; <BR>this.timeout = 150; <BR>this.speed = 20; <BR>this.step = 1; <BR>this.right = screen.width -1; <BR>this.bottom = screen.height; <BR>this.left = this.right - this.width; <BR>this.top = this.bottom - this.height; <BR>this.timer = 0; <BR>this.pause = false; <BR>this.close = false; <BR>this.autoHide = true; <BR>} <br><br>/**<BR>* メッセージメソッドを非表示にする <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.hide = function(){ <BR>if(this.onunload()){ <BR>var offset = this .height>this.bottom-this.top?this.height:this.bottom-this.top; <BR>var me = this; <BR>if(this.timer>0){ <BR>window.clearInterval(me.timer); <BR>} <br><br>var fun = function(){ <BR>if(me.pause==false||me.close){ <BR>var x = me.left; <BR>var y = 0; <BR>var width = me.width; <BR>var 高さ = 0; <BR>if(me.offset>0){ <BR>高さ = me.offset; <BR>} <BR>y = me.bottom - 高さ; <BR>if(y>=me.bottom){ <BR>window.clearInterval(me.timer); <BR>} else { <BR>me.offset = me.offset - me.step; <BR>} <BR>me.Pop.show(x,y,width,height); <BR>} <BR>} <BR>this.timer = window.setInterval(fun,this.speed) <BR>} <BR>} <br><br>/**<BR>* メッセージアンロードイベント、オーバーライド可能 <BR>*/ <BR> CLASS_MSN_MESSAGE.prototype.onunload = function() { <BR>return true; <BR>} <BR>/**<BR>* メッセージコマンドイベント、独自の接続を実装するには、書き換えてください <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.oncommand = function(){ <BR>this.close = true; <BR>this.hide(); <BR>window.open("http://www.lost63.com"); <BR>} <BR>/** <BR>* 消息显示方法 <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.show = function(){ <BR>var oPopup = window.createPopup(); //IE5.5+ <BR>this.Pop = oPopup; <br><br>var w = this.width; <BR>var h = this.height; <br><br>// "×"关闭按钮 <BR>/* <BR>str += "<tr>" <br>str += "<td style='font-size: 12px;color: #0f2c8c' width=30 height=24></td>" <br>str += "<td style='padding-left: 4px; font-weight: normal; font-size: 12px; color: #1f336b; padding-top: 4px' valign=center width='100%'>" + this.caption + "</td>" <br>str += "<td style='padding-right: 2px; padding-top: 2px' valign=center align=right width=19>" <br>str += "<span title=关闭 style='font-weight: bold; font-size: 12px; cursor: hand; color: red; margin-right: 4px' id='btsysclose' >×</span></td>" <br>str += "</tr>" <br>*/ <br>// 按钮style <br>// style='width:60px; height:20px; border-right: #002D96 1px solid; padding-right: 2px; border-top: #002D96 1px solid; padding-left: 2px; FONT-SIZE: 12px; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA); border-left: #002D96 1px solid; CURSOR: hand; color: black; padding-top: 2px; border-bottom: #002D96 1px solid;' <br><br>var str = "<div style='border-right: #455690 1px solid; border-top: #a6b4cf 1px solid; z-index: 99999; left: 0px; border-left: #a6b4cf 1px solid; width: " + w + "px; border-bottom: #455690 1px solid; position: absolute; top: 0px; height: " + h + "px; background-color: #c9d3f3'>" <br>str += "<table style='border-top: #ffffff 1px solid; border-left: #ffffff 1px solid' cellspacing=0 cellpadding=0 width='100%' bgcolor=#cfdef4 border=0>" <br><br>str += "<tr>" <br>str += "<td style='font-size: 12px;color: #0f2c8c' width=30 height=24></td>" <br>str += "<td style='padding-left: 4px; font-weight: normal; font-size: 12px; color: #1f336b; padding-top: 4px' valign=center width='100%'>" + this.caption + "</td>" <br>str += "</tr>" <br>str += "<tr>" <br>/*height:设置里面内容区域的高度 */ <br>str += "<td style='padding-right: 1px;padding-bottom: 1px' colspan=3 height=" + (h-50) + ">" <br>str += "<div style='border-right: #b9c9ef 1px solid; padding-right: 8px; border-top: #728eb8 1px solid; padding-left: 8px; font-size: 12px; padding-bottom: 8px; border-left: #728eb8 1px solid; width: 100%; color: #1f336b; padding-top: 8px; border-bottom: #b9c9ef 1px solid; height: 100%'>" + this.title + "<br><br>" <br>str += "<div style='word-break: break-all' align=left><a href='javascript:void(0)' hidefocus=false id='btcommand'><font color=#ff0000>" + this.message + "</font></a> - <a href='tencent://message/?uin=380522459&site=http://hi.baidu.com/lupeng0527&menu=yes' hidefocus=false id='ommand'><font color=#ff0000>有事您q我!</font></a></div>" <br>str += "</div>" <br>str += "</td>" <br>str += "</tr>" <br>str += "<tr align=center>" <br>str += "<td colspan=3>" <br>str += "<div style='padding: 2 0 2 0;'>" <br>str += "<span id='buttonClose'><input type='button' title=关闭 value=确认 style='width:60px; height:20px; border-right: #002D96 1px solid; padding-right: 2px; border-top: #002D96 1px solid; padding-left: 2px; FONT-SIZE: 12px; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA); border-left: #002D96 1px solid; CURSOR: hand; color: black; padding-top: 2px; border-bottom: #002D96 1px solid;'></span>" <br>str += "</div>" <br>str += "</td>" <br>str += "</tr>" <br>str += "</table>" <br>str += "</div>" <br><br>oPopup.document.body.innerHTML = str; <br>this.offset = 0; <br>var me = this; <br><br>oPopup.document.body.onmouseover = function(){me.pause=true;} <br>oPopup.document.body.onmouseout = function(){me.pause=true;} <br><br>var fun = function(){ <br>var x = me.left; <br>var y = 0; <br>var width = me.width; <br>var height = me.height; <br><br>if(me.offset>me.height){ <br>height = me.height; <br>} else { <br>height = me.offset; <br>} <br><br>y = me.bottom - me.offset; <br>if(y<=me.top){ <BR>//me.timeout--; <BR>if(me.timeout==0){ <BR>window.clearInterval(me.timer); <BR>if(me.autoHide){ <BR>me.hide(); <BR>} <BR>} <BR>} else { <BR>me.offset = me.offset me.step; <BR>} <BR>me.Pop.show(x,y,width,height); <BR>} <br><br>this.timer = window.setInterval(fun,this.speed) <br><br>//"确认"关闭事件 <br><br>var buttonClose = oPopup.document.getElementById("buttonClose"); <BR>buttonClose.onclick = function(){ <BR>me.close = true; <BR>me.hide(); <BR>} <BR>/* <BR>* "×"关闭事件 <BR>* var btClose = oPopup.document.getElementById("btSysClose"); <BR>* <BR>* btClose.onclick = function(){ <BR>* me.close = true; <BR>* me.hide(); <BR>* } <BR>*/ <br><br>var btCommand = oPopup.document.getElementById("btCommand"); <BR>btCommand.onclick = function(){ <BR>me.oncommand(); <BR>} <BR>var ommand = oPopup.document.getElementById("ommand"); <BR>ommand.onclick = function(){ <BR>this.close = true; <BR>me.hide(); <BR>window.open(ommand.href); <BR>} <BR>} <BR>/* <BR>* 设置速度方法 <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.speed = function(s){ <BR>var t = 20; <BR>try { <BR>t = praseInt(s); <BR>} catch(e){} <BR>this.speed = t; <BR>} <BR>/**<BR>* Set step size method <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.step = function(s){ <BR>var t = 1; <BR>try { <BR>t = praseInt(s); <BR>} catch(e){} <BR>this.step = t; <BR>} <br><br>CLASS_MSN_MESSAGE.prototype.rect = function(left,right,top,bottom){ <BR>try { <BR>this.left = left !=null?left:this.right-this.width; <BR>this.right = right !=null?right:this.left this.width; <BR>this.bottom = bottom!=null?(bottom>screen.height?screen.height:bottom):screen.height; <br>this.top = top !=null?top:this.bottom - this.height; <br>} catch(e){} <br>} <br>var MSG1 = new CLASS_MSN_MESSAGE("aa",240,150,"管理员:","思路决定出路","迷失路上"); <br>MSG1.rect(null,null,null,screen.height-50); <br>MSG1.speed = 10; <br>MSG1.step = 5; <br>//alert(MSG1.top); <br>//MSG1.show(); <br>//同时两个有闪烁,只能用层代替了,不过层不跨框架 <br>/* <br>var MSG2 = new CLASS_MSN_MESSAGE("aa",200,120,"短消息提示:","您有2封消息","好的啊"); <br>MSG2.rect(100,null,null,screen.height); <br>MSG2.show(); <br>*/ <br><br>/**<br>* Show tooltip <br>*/ <br>function showMSG(){ <br>MSG1.show(); <br>} <br><br>