怎样使层相对于屏幕居中显示?

怎样使层相对于屏幕居中显示?
---------------------------------------------------------------

 1<html>
 2<head>
 3<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
 4<title>登录</title>
 5<link href="default.css" rel="stylesheet"/>
 6<style type="text/css">   
 7BODY,TD,INPUT{font-size:9pt}   
 8.window { BORDER-RIGHT: #606060 2px solid; PADDING-RIGHT: 2px; BORDER-TOP: #f0f0f0 2px solid; PADDING-LEFT: 2px; VISIBILITY: ; PADDING-BOTTOM: 2px; MARGIN: 0px; BORDER-LEFT: #d0d0d0 2px solid; PADDING-TOP: 2px; BORDER-BOTTOM: #404040 2px solid; POSITION: absolute; BACKGROUND-COLOR: #184BA5; TEXT-ALIGN: left; }   
 9.titleBar {PADDING-RIGHT: 2px; PADDING-LEFT: 2px; FONT-WEIGHT: bold; FONT-SIZE: 9pt; PADDING-BOTTOM: 2px; MARGIN: 0px; WIDTH: auto; CURSOR: default; COLOR: #ffffff; PADDING-TOP: 2px; FONT-FAMILY: 宋体; WHITE-SPACE: nowrap;}   
10.titleBarText { PADDING-LEFT: 6px; OVERFLOW: hidden; TEXT-ALIGN: left;}   
11.clientArea {PADDING:10px; FONT-FAMILY: 宋体; BACKGROUND-COLOR: #ECF0E1}   
12</style>
13</head>
14<body onselectstart="return false">
15<div class="window" id="logon" style="filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#FF003399', EndColorStr='#FF6699CC');">
16<div class="titleBar"><img align="absmiddle" height="16" src="http://lucky.myrice.com/images/copyright.gif" width="16"/><span class="titleBarText">请先登录</span></div>
17<div class="clientArea" style="">
18<img align="absmiddle" src="http://lucky.myrice.com/images/security.gif"/>  请输入您授权管理的用户名和密码。   
19<br/><br/>
20<table align="center" border="0" cellpadding="0" cellspacing="6" width="300">
21<form action="http://lucky.myrice.com" method="post" name="LogonForm">
22<tr>
23<td align="center">服务器:</td>
24<td><a href="http://lucky.myrice.com" style="color:#000000;text-decoration:none">http://lucky.myrice.com</a></td>
25</tr>
26<tr>
27<td align="center">用户名:</td>
28<td><input name="UserName" style="border:1px solid gray" type="text" value=""/></td>
29</tr>
30<tr>
31<td align="center">密  码:</td>
32<td><input name="Password" style="border:1px solid gray" type="password"/></td>
33</tr>
34<tr>
35<td align="center" colspan="2">
36<input class="CustButton" name="logon" style="padding-top:2px" type="submit" value=" 登 录 "/>
37<input name="href" type="hidden" value=""/>
38</td>
39</tr>
40</form>
41</table>
42</div>
43</div>
44</body>
45</html>

---------------------------------------------------------------

1<body onload="change()">
2<div id="a1" style="width:200;height:100;background:red;position:absolute;">
3</div>
4<script language="javascript">   
5a1.style.left=(parseInt(screen.width)-parseInt(a1.style.width))/2-window.screenLeft;   
6a1.style.top=(parseInt(screen.height)-parseInt(a1.style.height))/2-window.screenTop;   
7</script></body>
Published At
Categories with Web编程
comments powered by Disqus