How to make the information box always show in the middle of the visible area of the browser

Source: Internet
Author: User
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> </title>
<Link href = "StyleSheet.css" rel = "stylesheet" type = "text/css"/>

<Script src = "jquery. js" type = "text/javascript"> </script>
<Script type = "text/javascript">
Function ShowMessageBox (){
Var _ width = document.doc umentElement. clientWidth;
Var _ height = document.doc umentElement. clientHeight;
$ ("# Div_msg" 2.16.css ("top", (_ height-$ ("# div_msg"). height ()/2 );
$ ("# Div_msg" ).css ("left", (_ width-$ ("# div_msg"). width ()/2 );

}
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
<A href = "javascript: void (0)" onclick = "ShowMessageBox ()"> Click </a>
<Div id = "div_msg" class = "div_msg" style = "position: absolute; left: 0; top: 0; width: 250px">
Saved successfully!
</Div>
</Div>
</Form>
</Body>
</Html>

If jQuery is used above, you can change it to a normal implementation.

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.