这个页面的悬浮窗不随滚动条移动,怎么修改?

geelpheels 2010-09-11 03:57:47
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title></title>
<link href="../frontstage/css/link.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" bordercolor="black" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<table>
<tr>
<td>
<div id="d" style="position:absolute;border: 1px #FF00FF solid;width:145px;">
<table><tr><td>剩余考试时间:</td><td id="nowTime" style="color:blue"> </td></tr></table></div>
</td>
</tr>
</table>
</td>
<td width="10%"></td>
</tr>
</table>
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
</body>
<script language="javascript">
var allTime = 3600;//倒计时的时长
var intervalID; //停止的时机
function changeTime(){
var nowHour = parseInt(allTime/3600);
if(nowHour<10) nowHour = "0" + nowHour;
var nowMin = parseInt((allTime%3600)/60);
if(nowMin<10) nowMin = "0" + nowMin;
var nowSoc = parseInt((allTime%3600)%60)%60;
if(nowSoc<10) nowSoc = "0" + nowSoc;
var nowTime = nowHour + ":" + nowMin + ":" + nowSoc;
document.getElementById("nowTime").innerText = nowTime;
//时间到自动提交
if(allTime==0){
//dosubmitclick(document.formName,'../testquestion/testQuestionExamResult.jsp','testEnd');
formsubmit();
clearInterval(intervalID);
}
if(allTime==300){
remind();
}
allTime--;
if(allTime==-1){
allTime = 0;
}
}
//最后五分钟提醒
function remind(){
alert("离考试结束还有5分钟,请尽快答题,时间到后系统会自动提交!");
return;
}
setInterval("changeColor()", 1000);
intervalID = setInterval("changeTime()", 1000);

//改变倒计时的颜色
var col;
function changeColor(){
if(col=="red"){
col = "blue";
document.getElementById("nowTime").style.color = col;
}else if(col=="blue"){
col = "green";
document.getElementById("nowTime").style.color = col;
}else{
col = "red";
document.getElementById("nowTime").style.color = col;
}
}
</script>
<script type="text/javascript" charset="utf-8">
var eDiv=document.getElementById("d");
eDiv.style.setAttribute("position","absolute");
eDiv.style.setAttribute("right","90px");
eDiv.style.setAttribute("top","190px");
</script>
</html>
...全文
284 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhangshaolongjj 2010-09-11
  • 打赏
  • 举报
回复
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<title></title>
<link href="../frontstage/css/link.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" bordercolor="black" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<table>
<tr>
<td>
<div id="d" style="position:absolute;border: 1px #FF00FF solid;width:145px;">
<table><tr><td>剩余考试时间:</td><td id="nowTime" style="color:blue"> </td></tr></table></div>
</td>
</tr>
</table>
</td>
<td width="10%"></td>
</tr>
</table>
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
a
<br>
</body>
<script language="javascript">
var allTime = 3600;//倒计时的时长
var intervalID; //停止的时机
function changeTime(){
var nowHour = parseInt(allTime/3600);
if(nowHour<10) nowHour = "0" + nowHour;
var nowMin = parseInt((allTime%3600)/60);
if(nowMin<10) nowMin = "0" + nowMin;
var nowSoc = parseInt((allTime%3600)%60)%60;
if(nowSoc<10) nowSoc = "0" + nowSoc;
var nowTime = nowHour + ":" + nowMin + ":" + nowSoc;
document.getElementById("nowTime").innerText = nowTime;
//时间到自动提交
if(allTime==0){
//dosubmitclick(document.formName,'../testquestion/testQuestionExamResult.jsp','testEnd');
formsubmit();
clearInterval(intervalID);
}
if(allTime==300){
remind();
}
allTime--;
if(allTime==-1){
allTime = 0;
}
}
//最后五分钟提醒
function remind(){
alert("离考试结束还有5分钟,请尽快答题,时间到后系统会自动提交!");
return;
}
setInterval("changeColor()", 1000);
intervalID = setInterval("changeTime()", 1000);

//改变倒计时的颜色
var col;
function changeColor(){
if(col=="red"){
col = "blue";
document.getElementById("nowTime").style.color = col;
}else if(col=="blue"){
col = "green";
document.getElementById("nowTime").style.color = col;
}else{
col = "red";
document.getElementById("nowTime").style.color = col;
}
}
</script>
<script type="text/javascript" charset="utf-8">
var eDiv=document.getElementById("d");
eDiv.style.setAttribute("position","absolute");
eDiv.style.setAttribute("right","90px");
eDiv.style.setAttribute("top","190px");
document.documentElement.onscroll = function(){
document.getElementById("d").style.top = 190 + document.documentElement.scrollTop + "px";

}
</script>
</html>

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧