日期:2014-05-17  浏览次数:20607 次

新浪微博站内应用,一个div悬浮框,IE下正常居中,非IE下严重偏移,求兼容的解决办法
新浪微博站内应用,一个div悬浮框,IE下正常居中,非IE下严重偏移,求兼容的解决办法

其代码如下,望高手能帮忙解决,差不多要上线了
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<<title>新建网页 1</title>
</head>
<body>
<style type="text/css">
body {
    font-size:14px
margin: 0px;padding:0
}
#div1 {
display: none;
position: absolute;
z-index: 1000;
height: 100%;
width: 100%;
background: #000000;
filter:Alpha(opacity=30);
 Opacity:0.3; /*非IE下的滤镜*/
}
#div2 {
display: none;
position: absolute;
height: 100%;
width: 100%;
padding-top: 10%;
z-index: 1001;
left: 0px;
top: 0px;
}
</style>
<script>
function openme(){
document.getElementById('div1').style.display='block';
document.getElementById('div2').style.display='block';
}
function closeme(){
document.getElementById('div1').style.display='none';
document.getElementById('div2').style.display='none';
}

</script>
<div id="div1"></div>
<div id="div2">
<table  align="center"width="499" height="299" border="0" cellpadding="0" cellspacing="0" background="img/1.jpg" >
<tr>
<td height="20px" align="right">
<input type="image" value="x" title="关闭" src="img/close.png" onClick="closeme()" style="cursor: hand;">
  </td>
</tr>
<tr>
<td >&nbsp;

  </td>
</tr>
</table>
</div>
<div>
<input name="button" type="button" onclick="openme()" value="登陆" />
</div>
<br>
<div>
简单的代码
</div>
</body>
</html>




------解决方案--------------------
<td height="20px" align="center" style=" position:absolute; top:45%;">
<input type="image" value="x" title="关闭" src="img/close.png" onClick="closeme()" >
</td>