问题,层在兼容模式或者IE6下显示,在ie9以上不能正常显示,请教!非常感谢。
页面:在兼容模式或者IE6下显示如下:图片里面的DIV层能够随页面上下移动。
代码:<div id="persistMenu" style="position: absolute; height:150px; width:168px; left:650px; top:1px;z-index: 100; visibility: hidden" class="blueborder">
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber4" class="outborder" height="30">
<tr>
<td width="100%">
<p align="center"><font color="#FFFF00">计 时 器</font>
</td>
</tr>
</table>
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber2" class="outborder" cellpadding="0">
<tr>
<td>
<div align="center">
<center>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" id="AutoNumber3">
<tr>
<td height="30">
<p align="center"><font color="#FFFFFF">时间 </font></td>
<td>
<input type="text" name="MyTestTime" size="10" class="inputborder" readonly></td>
<td height="30">
<p align="center"><font color="#FFFFFF"> 分钟</font></td>
</tr>
<tr>
<td height="30">
<p align="center"><font color="#FFFFFF">剩余 </font></td>
<td>
<input type="text" name="lefttime" size="10" class="inputborder" readonly></td>
<td height="30">
<p align="center"><font color="#FFFFFF"> 分钟</font></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber4" class="outborder" height="30">
<tr>
<td width="100%">
<p align="center">
<input type="submit" value="我要交作业" name="BB3" class="s02"></td>
</tr>
</table>
</div>
可是在IE9以上,倒计时框就不能移动了,倒计时时间也不现实了如下图:还有用到showtime.asp 时间代码如下:<html>
<head>
<base target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css"><style>
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
<!--body, p, td, input { color:#ffffff;font-size: 9pt }-->
</style>
<script>var timerID = null
var timerRunning = false
function MakeArray(size) {
this.length = size;
for(var i = 1; i <= size; i++)this[i] = "";
return this;
}//初始化变量
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false
}//停止始终函数
function showtime (){
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day = now.getDay();
Day = new MakeArray(7);
Day[0]="星期天";
Day[1]="星期一";
Day[2]="星期二";
Day[3]="星期三";
Day[4]="星期四";
Day[5]="星期五";
Day[6]="星期六";
var timeValue = "";
timeValue += year + "年";
timeValue += ((month < 10) ? "0" : "") + month + "月";
timeValue += date + "日 ";
timeValue += (Day[day]) + " ";
timeValue += ((hours <= 12) ? hours : hours - 12);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
timeValue += (hours < 12) ? "上午" : " 下午";
document.all.clock.innerText = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true
}//标准日期到中文日期的转化函数
function startclock () {
stopclock();
showtime()
}//打开闹钟函数
</script>
</head>
<body bgcolor="#6699CC" topmargin="0" leftmargin="0" onLoad="startclock()">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="100%">
<tr>
<td valign="bottom" id="clock"></td>
</table>
</body>
</html>
win7ie9移动
页面:在兼容模式或者IE6下显示如下:图片里面的DIV层能够随页面上下移动。
代码:<div id="persistMenu" style="position: absolute; height:150px; width:168px; left:650px; top:1px;z-index: 100; visibility: hidden" class="blueborder">
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber4" class="outborder" height="30">
<tr>
<td width="100%">
<p align="center"><font color="#FFFF00">计 时 器</font>
</td>
</tr>
</table>
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber2" class="outborder" cellpadding="0">
<tr>
<td>
<div align="center">
<center>
<table border="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" id="AutoNumber3">
<tr>
<td height="30">
<p align="center"><font color="#FFFFFF">时间 </font></td>
<td>
<input type="text" name="MyTestTime" size="10" class="inputborder" readonly></td>
<td height="30">
<p align="center"><font color="#FFFFFF"> 分钟</font></td>
</tr>
<tr>
<td height="30">
<p align="center"><font color="#FFFFFF">剩余 </font></td>
<td>
<input type="text" name="lefttime" size="10" class="inputborder" readonly></td>
<td height="30">
<p align="center"><font color="#FFFFFF"> 分钟</font></td>
</tr>
</table>
</center>
</div>
</td>
</tr>
</table>
<table border="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#6699CC" width="168" id="AutoNumber4" class="outborder" height="30">
<tr>
<td width="100%">
<p align="center">
<input type="submit" value="我要交作业" name="BB3" class="s02"></td>
</tr>
</table>
</div>
可是在IE9以上,倒计时框就不能移动了,倒计时时间也不现实了如下图:还有用到showtime.asp 时间代码如下:<html>
<head>
<base target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css"><style>
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
<!--body, p, td, input { color:#ffffff;font-size: 9pt }-->
</style>
<script>var timerID = null
var timerRunning = false
function MakeArray(size) {
this.length = size;
for(var i = 1; i <= size; i++)this[i] = "";
return this;
}//初始化变量
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false
}//停止始终函数
function showtime (){
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day = now.getDay();
Day = new MakeArray(7);
Day[0]="星期天";
Day[1]="星期一";
Day[2]="星期二";
Day[3]="星期三";
Day[4]="星期四";
Day[5]="星期五";
Day[6]="星期六";
var timeValue = "";
timeValue += year + "年";
timeValue += ((month < 10) ? "0" : "") + month + "月";
timeValue += date + "日 ";
timeValue += (Day[day]) + " ";
timeValue += ((hours <= 12) ? hours : hours - 12);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
timeValue += (hours < 12) ? "上午" : " 下午";
document.all.clock.innerText = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true
}//标准日期到中文日期的转化函数
function startclock () {
stopclock();
showtime()
}//打开闹钟函数
</script>
</head>
<body bgcolor="#6699CC" topmargin="0" leftmargin="0" onLoad="startclock()">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1" height="100%">
<tr>
<td valign="bottom" id="clock"></td>
</table>
</body>
</html>
win7ie9移动
<!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>
<style type="text/css">
html,body{margin:0;padding:0;}
#y4 {position:fixed;bottom:0;right:0;width:400px;height:100px;border:1px solid red;}
</style><script>
var timerID = null
var timerRunning = false
function MakeArray(size) {
this.length = size;
for(var i = 1; i <= size; i++)this[i] = "";
return this;
}//初始化变量
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false
}//停止始终函数
function showtime (){
var now = new Date();
var year = now.getYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
var day = now.getDay();
Day = new MakeArray(7);
Day[0]="星期天";
Day[1]="星期一";
Day[2]="星期二";
Day[3]="星期三";
Day[4]="星期四";
Day[5]="星期五";
Day[6]="星期六";
var timeValue = "";
timeValue += year + "年";
timeValue += ((month < 10) ? "0" : "") + month + "月";
timeValue += date + "日 ";
timeValue += (Day[day]) + " ";
timeValue += ((hours <= 12) ? hours : hours - 12);
timeValue += ((minutes < 10) ? ":0" : ":") + minutes;
timeValue += ((seconds < 10) ? ":0" : ":") + seconds;
timeValue += (hours < 12) ? "上午" : " 下午";
document.getElementById("clock").innerHTML = timeValue;
timerID = setTimeout("showtime()",1000);
timerRunning = true
}//标准日期到中文日期的转化函数
function startclock () {
stopclock();
showtime();
}//打开闹钟函数
</script>
<script type="text/javascript">
//以下所有脚本只为IE6写,其他浏览器完全可以删除。
function getViewportScrollX() {
var scrollX = 0;
if (document.documentElement && document.documentElement.scrollLeft) {
scrollX = document.documentElement.scrollLeft;
}
else if (document.body && document.body.scrollLeft) {
scrollX = document.body.scrollLeft;
}
else if (window.pageXOffset) {
scrollX = window.pageXOffset;
}
else if (window.scrollX) {
scrollX = window.scrollX;
}
return scrollX;
} function getViewportScrollY() {
var scrollY = 0;
if (document.documentElement && document.documentElement.scrollTop) {
scrollY = document.documentElement.scrollTop;
}
else if (document.body && document.body.scrollTop) {
scrollY = document.body.scrollTop;
}
else if (window.pageYOffset) {
scrollY = window.pageYOffset;
}
else if (window.scrollY) {
scrollY = window.scrollY;
}
return scrollY;
} function getViewportWidth() {
var width = 0;
if (document.documentElement && document.documentElement.clientWidth) {
width = document.documentElement.clientWidth;
}
else if (document.body && document.body.clientWidth) {
width = document.body.clientWidth;
}
else if (window.innerWidth) {
width = window.innerWidth - 18;
}
return width;
} function getViewportHeight() {
var height = 0;
if (window.innerHeight) {
height = window.innerHeight - 18;
}
else if (document.documentElement && document.documentElement.clientHeight) {
height = document.documentElement.clientHeight;
}
else if (document.body && document.body.clientHeight) {
height = document.body.clientHeight;
}
return height;
}
//ie6和Quirk模式单独处理
if (document.compatMode != 'CSS1Compat' || (navigator.userAgent.indexOf("MSIE 6") > -1 && navigator.userAgent.indexOf("MSIE 7") == -1 && navigator.userAgent.indexOf("MSIE 8") == -1)) {
window.onload = window.onscroll = window.onresize = function (e) {
var t = getViewportScrollY();
var l = getViewportScrollX();
var w = getViewportWidth();
var h = getViewportHeight();
document.getElementById("y4").style.position="absolute"
document.getElementById("y4").style.left = l + w - document.getElementById("y4").offsetWidth + "px";
document.getElementById("y4").style.top = t + h - document.getElementById("y4").offsetHeight + "px";
startclock()
}
}
else{
window.onload=startclock;
}
</script></head>
<body>
<div id="y4">
<table border="0" cellpadding="0" cellspacing="0" bordercolor="#111111" width="100%" id="AutoNumber1" height="100%">
<tr>
<td valign="bottom" id="clock"></td>
</table>
</div>
<p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p>
<p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p>
<p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p>
<p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p><p>a</p>
<script></script>
</body>
</html>