简体   繁体   中英

Display Message box in javascript

I'm creating a message box in JavaScript with the following

<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;".

Where 200 and 100 are actually width/2 and height/2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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