简体   繁体   English

在JavaScript中显示消息框

[英]Display Message box in javascript

I'm creating a message box in JavaScript with the following 我正在使用以下代码在JavaScript中创建一个消息框

<div id="uLightBox" style="top: 4906px; left: 236px;">
    <div id="lbHeader" class="top"><header>Alert</header></div>
    <div id="lbContent">User cannot be deleted.</div>
    <div id="lbFooter" class="bottom">
        <input type="button" class="flat floatRight" value="OK" id="OK">
    </div>
</div>

But this message box is displaying in the middle of the page. 但是此消息框显示在页面中间。 Whereas my page is displaying more than hundred records. 而我的页面显示了一百多条记录。 If my message box is displayed in the middle of the page I have to scroll down each and every time. 如果我的消息框显示在页面的中间,则每次都必须向下滚动。 Please suggest... 请建议...

Thanks, 谢谢,

Kath 凯思

Use something like this: style="position: fixed; left: 50%; top: 50%; margin-left: -200px; margin-top: -100px;". 使用类似这样的样式:style =“ position:fixed; left:50%; top:50%; margin-left:-200px; margin-top:-100px;”。

Where 200 and 100 are actually width/2 and height/2. 其中200和100实际上是width / 2和height / 2。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM