div悬浮框代码

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!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>
<title>无标题页</title>
<!-- 设置悬浮窗口 -->
<script type="text/javascript">
function scall(){
document.getElementById("topdiv").style.top=(document.documentElement.scrollTop)+150+"px";
document.getElementById("topdiv").style.left=(document.documentElement.scrollLeft+document.documentElement.clientWidth-document.getElementById("topdiv").offsetWidth)-60+"px";
}
window.οnscrοll=scall;
window.οnresize=scall;
window.οnlοad=scall;
</script>
<!-- 计算剩余时间 -->
<script language="javascript">
var timer;
var examTimer=150*60;
var lastSecond,lastMinute;
timer=setInterval("showtime()",1000);
function showtime(){
examTimer--;
if (examTimer<=0){
document.all.lastTime.innerHTML="0:00";
clearInterval(timer);
//调用自动提交试卷函数
paperSubmit('',1);
}
else{
lastSecond=examTimer % 60;
lastMinute=(examTimer-lastSecond)/60;
document.all.lastTime.innerHTML=lastMinute + ":" + (lastSecond<10?"0"+lastSecond:lastSecond);
}
}
function paperSubmit(strNO,isAuto){
if (isAuto==1){
alert("你的答题时间已到,请按确认进行交卷!");
}
else{
if (!confirm("是否确定交卷呢?"))return;
}
}
</script>
<style type="text/css">
<!--
悬浮窗口 -->#topdiv {
position: absolute;
width: 87px;
height: 116px;
z-index: 1;
text-align: center;
}

.hot {
font-weight: normal;
color: #002899;
margin-left: 10px;
font-size: 12px;
font-weight: bold;
}

.red {
color: #FF0000;
}
</style>
</head>
<body>
<div align="center">
<center>
<table width="770px" border="0" cellpadding="0" cellspacing="0"
bgcolor="#F4F4F4">
<tr>
<td height="3000px" valign="top"></td>
</tr>
</table>
</center>
</div>
<div id="topdiv"
style="POSITION: absolute; z-index: 1000; background-image: url(images/float.gif);">
<table width="87px" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30" align="center" valign="bottom" class="hot">
答题剩余时间
</td>
</tr>
<tr>
<td height="40px" align="center" class="red">
<table width="70" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" bgcolor="#FFFFFF">
<label id="lastTime">
150:00
</label>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center" height="46px">
<input type="image" src="images/jj-button.gif" width="67"
height="24" οnclick="paperSubmit('1','')" />
</td>
</tr>
</table>
</div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值