Use JavaScript as a message prompt box (similar to a message prompt sent to QQ users)

Source: Internet
Author: User
When developing a project, you need to remind the user when there is a user message, just like your QQ friends online, QQ automatically pop up a message prompt, I think it is good. Therefore, JavaScript uses popup for a similar function.

<HTML>
<Head>
<Title> htmlpage1 </title>
<Meta name = "vs_defaultclientscript" content = "JavaScript">
<Meta name = "vs_targetschema" content = "http://schemas.microsoft.com/intellisense/ie5";>
<Meta name = "generator" content = "Microsoft Visual Studio. NET 7.1">
<Meta name = "progid" content = "visualstudio. html">
<Meta name = "originator" content = "Microsoft Visual Studio. NET 7.1">
</Head>

<Script language = JavaScript>
VaR titlepopup
VaR Len;

Function initmsgbox ()
{Len = 0;
Titlepopup = Window. createpopup ();
VaR titlepopupbody = titlepopup.doc ument. Body;
Titlepopupbody. style. Border = "solid black 1px ";
VaR titlecontent = "";
Titlecontent = titlecontent + "<Table cellpadding = '5' bgcolor = '# 65c1ff 'width = '000000' Height = '000000' border = 0 cellspacing = 0 cellpadding = 0> ";
Titlecontent = titlecontent + "<tr> <TD align = center> <font size = 2> message reminder </font> </TD> </tr> ";
Titlecontent = titlecontent + "<tr> <TD> <font size = 2> content </TD> </font> </tr> ";
Titlecontent = titlecontent + "<tr> <TD> <font size = 2> content </TD> </font> </tr> ";
Titlecontent = titlecontent + "<tr> <TD> <font size = 2> date </TD> </font> </tr> ";
Titlecontent = titlecontent + "</table> ";
Titlepopupbody. innerhtml = titlecontent;

Showmsgbox ();
}

Function msgbox ()
{
Len + = 4;
If (LEN> 110)
{
Window. clearinterval (TID );
}
Else
{// 170 fixed the width of the message prompt box
Titlepopup. Show (document. Body. clientwidth-170, document. Body. clientheight-Len, 170, Len, top.doc ument. 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>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.