Friendly dialog box

Source: Internet
Author: User
1 function showmessage (MSG, bgcolor, bordercolor) {2 if ($ ("# showdiv "). length <= 0) {3 var DIV = invalid argument Doc ument. createelement ("Div"); 4 Div. innerhtml = MSG; 5 Div. id = "showdiv"; 6 Div. style. color = "black"; 7 Div. style. width = "400px"; 8 DIV. style. height = "Auto"; 9 Div. style. padding = "15px"; 10 Div. style. lineheight = "22px"; 11 Div. style. overflow = "Auto"; 12 Div. style. border = bordercolor; 13 Div. style. display = "NONE"; 14 Div. style. position = "fixed"; 15 Div. style. zindex = 40; 16 Div. style. fontfamily = "Microsoft yahei"; 17 Div. style. fontsize = "15px"; 18 19 Div. style. background = bgcolor; 20 var P = too many Doc ument. createelement ("p"); 21 p. style. marginbottom = "0px"; 22 p. style. textalign = "right"; 23 24 Response (p;.html ("<a id = 'closea' href = 'javascript: void (0) 'style = 'text-Decoration: none '> close </a> "); 25 Div. appendchild (p); 26 too many Doc ument. body. appendchild (DIV); 27 28 Div. style. left = (registry.document.doc umentelement. clientwidth/2-parseint (div. style. width, 10)/2) + "PX"; 29 Div. style. top = registry.document.doc umentelement. clientheight/2-$ (DIV ). height ()/2 + "PX"; 30 animationdiv (DIV); 31 32 // you need to bind the event after the element is loaded by the body, otherwise, the event 33 $ ("# closea") cannot be executed before loading "). click (function () {34 $ ("# showdiv "). remove (); 35}); 36 37 $ (window ). resize (function () {38 Div. style. left = (registry.document.doc umentelement. clientwidth/2-parseint (div. style. width, 10)/2) + "PX"; 39 Div. style. top = registry.document.doc umentelement. clientheight/2-$ (DIV ). height ()/2 + "PX"; 40 }); 41 42} else {43 // $ ("# showdiv" cmd.html (MSG + "<P style = 'text-align: right '> <a id = 'closea' href = 'javascript: void (0)' style = 'text-Decoration: none '> close </a> </P> "); 44 // The event is bound after the element is loaded by the body, otherwise, the event cannot be executed before loading: 45 $ ("# closea "). click (function () {46 $ ("# showdiv "). remove (); 47}); 48} 49}

 

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.