仿msn,右下角信息提示页

1
< scriptlanguage = " JavaScript " type = " text/javascript " >
function Queue() ... {
varitems=newArray();
varfirst=0;
varcount=0;
this.Count=function()...{returncount;};
this.Peek=function(last)...{
varresult=null;
if(count>0)...{
if(null!=last&&true==last)
result
=items[first+(count-1)];
else
result
=items[first];
}

returnresult;
}
;
this.Enqueue=function(x)...{
items[first
+count]=x;
count
++;
returnx;
}
;
this.Dequeue=function()...{
varresult=null;
if(count>0)...{
result
=items[first];
deleteitems[first];
first
++;
count
--;
}

returnresult;
}
;
}


function Popup_Close() ... {
if(this.popup!=null)
this.popup.document.onmouseover=null;
else
this.win.Win.onmouseover=null;
this.isMouseOver=false;
this.ShowTime=function()...{return3;}
this.Hide();
}


function Popup_Hide() ... {
if(this.popup!=null&&this.popup.isOpen)...{
this.popup.hide();
}

this.popup=null;
}


function Popup_ShowTime() ... {
varresult=null;
if(this.showTime!=null)...{
varnow=newDate();
result
=(now-this.showTime)/1000;
}

returnresult;
}


function OnClick_Popup(id) ... {
alert(id);
}



function Popup_CreateBody(winID,title,message) ... {
bodyhtml
="<tableid="+winID+"style="BORDER-RIGHT:#4556901pxsolid;BORDER-TOP:#a6b4cf1pxsolid;LEFT:0px;BORDER-LEFT:#a6b4cf1pxsolid;WIDTH:180px;BORDER-BOTTOM:#4556901pxsolid;POSITION:absolute;TOP:0px;HEIGHT:102px;BACKGROUND-COLOR:#1c5b94">"+" "+"<tr>"+" "+"<td>"+" "+"<tablecellSpacing=0cellPadding=0width="100%"bgColor=#1c5b94border=0>"+" "+"<tbody>"+" "+"<tr>"+" "+"<tdstyle="FONT-SIZE:12px;COLOR:#FFFFFF;">"+title+"</td>"+" "+"</tr>"+" "+"<trbgcolor="#d7e7f2"onMouseOver="this.style.backgroundColor='#f0f0f0'"onMouseOut="this.style.backgroundColor='#d7e7f2'">"+" "+"<tdwidth="100%"align=leftheight=76>"+" "+"<DIVstyle="BORDER-RIGHT:#9c9e9c1pxsolid;PADDING-RIGHT:13px;BORDER-TOP:#9c9e9c1pxsolid;PADDING-LEFT:13px;FONT-SIZE:12px;PADDING-BOTTOM:13px;BORDER-LEFT:#9c9e9c1pxsolid;WIDTH:100%;COLOR:#1f336b;PADDING-TOP:15px;BORDER-BOTTOM:#9c9e9c1pxsolid;HEIGHT:100%">"+" "+message+" "+"</td>"+" "+"</tr>"+" "+"</tbody>"+" "+"</table>"+" "+"</td>"+" "+"</tr>"+" "+"</table>"
returnbodyhtml;
}


function Popup_Show()
... {
this.showTime=newDate();
this.popup=window.createPopup();
vard=this.popup.document;
varb=d.body;
b.rightmargin
=0;
b.leftmargin
=0;
b.topmargin
=0;
b.bottommargin
=0;
b.innerHTML
=this.aspxl;

vartoastWidth=180;
vartoastHeight=102;
vartoastVerticalMargin=28;
vartoastHorizontalMargin=16;
varscreenWidth=window.screen.width;
varscreenHeight=window.screen.height;
this.popup.show(screenWidth-toastWidth-toastHorizontalMargin,screenHeight-toastHeight-toastVerticalMargin,toastWidth,toastHeight);
}



function Popup(winID,message,title) ... {
this.PostID;
this.CreateBody=Popup_CreateBody;
this.Close=Popup_Close;
this.Hide=Popup_Hide;
this.Show=Popup_Show;
this.ShowTime=Popup_ShowTime;
this.aspxl=this.CreateBody(winID,message,title);
}


function PopupManager() ... {
varqueue=newQueue();
varcanShow=(window.createPopup!=null);
this.Disabled=false;
this.Heartbeat=function()...{
if(queue.Count()>0)...{
varp=queue.Peek();
vardelta=p.ShowTime();
if(delta==null)...{
if(!this.Disabled)
p.Show();
}

elseif((p.popup==null)||(!p.popup.isOpen)||(!p.isMouseOver&&delta>=3))...{
p.Hide();
queue.Dequeue();
}

}

}

this.AddPopup=function(winID,message,title)...{
varresult=null;
do...{
if(canShow)...{
result
=newPopup(winID,message,title);
result.PopupManager
=this;
queue.Enqueue(result);
this.Heartbeat();
}

}

while(false);
returnresult;
}

}




var popupManager = new PopupManager();
window.setInterval(
" popupManager.Heartbeat(); " , 1500 );
var p = popupManager.AddPopup( " aa " , " 111 " , " 11111111111 " );
p.PostID
= 1 ;
p
= popupManager.AddPopup( " bb " , " 2222 " , " 222222222 " );
p.PostID
= 3 ;
p
= popupManager.AddPopup( " popupWin " , " 3333 " , " 33333333333 " );
p.PostID
= 6 ;

</ script >
2
< SCRIPT >
var oPopup = window.createPopup();
var popTop = 50 ;
function popmsg(titlestr,msgstr) ... {
varwinstr="<tableid=eMengstyle="BORDER-RIGHT:#4556901pxsolid;BORDER-TOP:#a6b4cf1pxsolid;LEFT:0px;BORDER-LEFT:#a6b4cf1pxsolid;WIDTH:180px;BORDER-BOTTOM:#4556901pxsolid;POSITION:absolute;TOP:0px;HEIGHT:102px;BACKGROUND-COLOR:#1c5b94">"+" "+"<tr>"+" "+"<td>"+" "+"<tablecellSpacing=0cellPadding=0width="100%"bgColor=#1c5b94border=0>"+" "+"<tbody>"+" "+"<tr>"+" "+"<tdstyle="FONT-SIZE:12px;COLOR:#FFFFFF;">"+titlestr+"</td>"+" "+"<tdalign="right"valign="top"><imgid="imgClose"src="Images/closePNormal.gif"width="16"height="16"border="0"onClick="parent.oPopup.hide()"alt="关闭"></td>"+" "+"</tr>"+" "+"<trbgcolor="#d7e7f2"onMouseOver="this.style.backgroundColor='#f0f0f0'"onMouseOut="this.style.backgroundColor='#d7e7f2'">"+" "+"<tdwidth="100%"align=leftcolSpan=2height=76>"+" "+"<DIVstyle="BORDER-RIGHT:#9c9e9c1pxsolid;PADDING-RIGHT:13px;BORDER-TOP:#9c9e9c1pxsolid;PADDING-LEFT:13px;FONT-SIZE:12px;PADDING-BOTTOM:13px;BORDER-LEFT:#9c9e9c1pxsolid;WIDTH:100%;COLOR:#1f336b;PADDING-TOP:15px;BORDER-BOTTOM:#9c9e9c1pxsolid;HEIGHT:100%">"+"
分享到:
评论

你可能感兴趣的:(JavaScript)