또한 China Unicom의 IOM 프로젝트를 진행하면서 요구 사항에 직면했는데, 이는 30분마다 페이지에 프롬프트 메시지가 팝업되어야 했습니다(메시지는 QQ News와 유사한 형식으로 팝업됩니다). 당시 인터넷에서 그런 정보를 찾았는데 원문의 출처가 기억나지 않습니다. 코드 복사 코드 다음과 같습니다. <머리> 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>함수 CLASS_MSN_MESSAGE(id,width,height,caption,title,message,target,action){ <BR>이것입니다. 아이디 = 아이디; <BR>this.title = 제목; <BR>this.caption = 캡션; <BR>this.message = 메시지; <BR>this.target = 대상; <BR>this.action = 액션; <BR>this.width = 너비?너비:200; <BR>this.height = 높이?높이:120; <BR>this.timeout = 150; <BR>this.speed = 20; <BR>this.step = 1; <BR>this.right = screen.width -1; <BR>this.bottom = 화면.높이; <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 .높이>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 너비 = 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,너비,높이); <br>} <br>} <br>this.timer = window.setInterval(fun,this.speed) <br>} <br>} <br><br>/**<br>* 메시지 언로드 이벤트, 재정의 가능 <br>*/ <br> CLASS_MSN_MESSAGE.prototype.onunload = function() { <br> 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 = 기능 (){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>높이 = me.height; <br>} else { <br>높이 = me.offset <br>} <br><br>y = me.bottom - <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; .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 = <br>me.hide(); >} <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 = 기능{ <BR>var t = 20; <BR>try { <BR>t = praseInt(s); <BR>} catch(e){} <BR>this.speed = t; <BR>} <BR>/**<BR>* 단계 크기 방법 설정 <BR>*/ <BR>CLASS_MSN_MESSAGE.prototype.step = 함수{ <BR>var t = 1; <BR>try { <BR>t = praseInt(s); <BR>} catch(e){} <BR>this.step = t; <BR>} <BR><BR>CLASS_MSN_MESSAGE.prototype.lect = function(left,right,top,bottom){ <BR>try { <BR>this.left = left !=null?left:this.right- this.width; <BR>this.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.ect(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.direct(100,null,null,screen.height); <br>MSG2.show(); <br>*/ <br><br>/**<br>* 툴팁 표시 <br>*/ <br>function showMSG(){ <br>MSG1.show(); <br>} <br><br> <본문>