Anti-Sina Blog js pop-up trial window

Source: Internet
Author: User

/*
Author: Daviv
Blog: http://blog.163.com/jxdawei
Time: 2006-10-27
Thank you: wenming (Blueidea)

Function: a prompt is displayed.
Method: Call sAlert ("information you want to bring up ");

*/

Function sAlert (str ){
Var msgw, msgh, bordercolor;
Msgw = 400; // The width of the prompt window.
Msgh = 100; // The height of the prompt window.
Titleheight = 25 // The title height of the prompt window
Bordercolor = "#336699"; // specifies the border color of the prompt window.
Titlecolor = "#99 CCFF"; // The title Color of the prompt window

Var sWidth, sHeight;
SWidth = document. body. offsetWidth;
SHeight = document. body. offsetHeight;
If (sHeight <screen. height)
{
SHeight = screen. height;
}

Var bgObj = document. createElement ("div ");
BgObj. setAttribute ('id', 'bgdiv ');
BgObj. style. position = "absolute ";
BgObj. style. top = "0 ";
BgObj. style. background = "#777 ";
BgObj. style. filter = "progid: DXImageTransform. Microsoft. Alpha (style = 3, opacity = 25, finishOpacity = 75 ";
BgObj. style. opacity = "0.6 ";
BgObj. style. left = "0 ";
BgObj. style. width = sWidth + "px ";
BgObj. style. height = sHeight + "px ";
BgObj. style. zIndex = "10000 ";
Document. body. appendChild (bgObj );

Var msgObj = document. createElement ("div ")
MsgObj. setAttribute ("id", "msgDiv ");
MsgObj. setAttribute ("align", "center ");
MsgObj. style. background = "white ";
MsgObj. style. border = "1px solid" + bordercolor;
MsgObj. style. position = "absolute ";
MsgObj. style. left = "50% ";
MsgObj. style. top = "50% ";
MsgObj. style. font = "12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif ";
MsgObj. style. marginLeft = "-225px ";
MsgObj. style. marginTop = -7520.document.doc umentElement. scrollTop + "px ";
MsgObj. style. width = msgw + "px ";
MsgObj. style. height = msgh + "px ";
MsgObj. style. textAlign = "center ";
MsgObj. style. lineHeight = (msgh-titleheight) + "px ";
MsgObj. style. zIndex = "10001 ";

Var title = document. createElement ("h4 ");
Title. setAttribute ("id", "msgTitle ");
Title. setAttribute ("align", "right ");
Title. style. margin = "0 ";
Title. style. padding = "3px ";
Title. style. background = bordercolor;
Title. style. filter = "progid: DXImageTransform. microsoft. alpha (startX = 20, startY = 20, finishX = 100, finishY = 100, style = 1, opacity = 75, finishOpacity = 100 );";
Title. style. opacity = "0.75 ";
Title. style. border = "1px solid" + bordercolor;
Title. style. height = "18px ";
Title. style. font = "12px Verdana, Geneva, Arial, Helvetica, sans-serif ";
Title. style. color = "white ";
Title. style. cursor = "pointer ";
Title. innerHTML = "disabled ";
Title. onclick = function (){
Document. body. removeChild (bgObj );
Document. getElementById ("msgDiv"). removeChild (title );
Document. body. removeChild (msgObj );
}
Document. body. appendChild (msgObj );
Document. getElementById ("msgDiv"). appendChild (title );
Var txt = document. createElement ("p ");
Txt. style. margin = "1em 0"
Txt. setAttribute ("id", "msgTxt ");
Txt. innerHTML = str;
Document. getElementById ("msgDiv"). appendChild (txt );
}

Related Article

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.