如何在点击提交的时候把开始时间和结束时间一起跟表单提交?

anbs01 2008-10-14 03:09:10


……

<form name='paper' method="post" action="paper_over.asp?paperno=<%=paperno%>">

……
<input type="submit" value="·提交·" name="B2" >
</form>

</body>
</html>
<!-- PersistentLayer-->
<input type='hidden' name='starttime' value='<%=Time()%>' size='20'>
<div id='persistMenu' style='position: absolute; height:170; width:166; left:830; top:106;z-index: 100; visibility: hidden' >
<table width="160" height="240" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="file:///G|/xychina24/exams/image/bg.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center" style="font-size:16; font-weight:bold">计 时 器</td>
</tr>
<tr>
<td height="160"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="15" style="font-size:12px">开始时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' name='mystarttime' size='11' class="s01" readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">结束时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' name='myendtime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">剩余时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' name='lefttime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">现在时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' name='xintime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
</table></td>
</tr>
<tr>
<td height="40" align="center"><input type='submit' value='我要交卷' name='B3' class='s02' onclick='submitit(1)' style='color: #58595B'></td>
</tr>
</table></td>
</tr>
</table>
</div>
<script language='javascript'>
var mys=60*<%=shijian%>
MM_showHideLayers('persistMenu','','show');
ScrollMenu();
var now1 = new Date();
var hours1 = now1.getHours();
var minutes1 = now1.getMinutes();
var seconds1 = now1.getSeconds();
var timeValue1 = hours1 + ':' + minutes1 + ':' + seconds1
document.all.mystarttime.value=timeValue1;

minutes1=minutes1+<%=shijian%>
if(minutes1>60)
{
hours1=hours1+Math.floor(minutes1/60)
minutes1=minutes1%60
}

document.all.myendtime.value=hours1+':'+minutes1+':'+seconds1
//var kcid = <%=kcid%>
var paperno = <%=paperno%>
startclock();
var timerID = null;
var timerRunning = false;
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 timeValue = hours + ':' + minutes + ':' + seconds



mys=mys-1
var mym=Math.floor(mys /60)
var myh=0
if(mym>60)
{
myh=Math.floor(mym/60)
mym=mym%60
}
var sec=mys%60
document.all.xintime.value = timeValue
document.all.lefttime.value =myh+':'+mym+':'+sec;

if (mym<0)
{
if (mys<0)
{
alert('考试时间到,请提交您的试卷!');
paper.action="paper_over.asp?paperno=<%=paperno%>"
paper.submit();
}
}

zuihou();
zuihou1();
timerID = setTimeout('showtime()',1000);
timerRunning = true;
}
function startclock () {
stopclock();
showtime();
}
function zuihou(){
if (document.all.lefttime.value=='0:1:0')
{
alert('考试时间还剩1分钟,请检查答案,并提交试卷!');
}
}
function zuihou1(){
if (document.all.lefttime.value=='0:0:10')
{
alert('还剩10秒钟,请检查答案,并提交试卷!');
}
}
function submitit(id)
{
if (confirm('未到交卷时间,您确定要提前交卷么?'))
{
paper.action="paper_over.asp?paperno=<%=paperno%>"
paper.submit();
}
}
</script>


如何在点击提交的时候把开始时间和所用时间一起跟表单提交?
...全文
176 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
Lee2K 2008-10-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 luxu001207 的回复:]
<form name='paper' method="post" action="paper_over.asp?paperno= <%=paperno%>">

在这个form里套上隐藏表单,用js把开始时间,所用时间写入隐藏表单中,然后再提交
[/Quote]

同意!
Atai-Lu 2008-10-14
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 chinmo 的回复:]
你不是有了标单了吗?后台直接读取就可以了啊
[/Quote]
他的<form/>标记好像套的不是地方...
www_7di_net 2008-10-14
  • 打赏
  • 举报
回复
……
<script language="JavaScript">
function DoSubmit(){
document.getElementById('A1').value=document.getElementById('AA1').value;
document.getElementById('A2').value=document.getElementById('AA2').value;
document.getElementById('A3').value=document.getElementById('AA3').value;
document.getElementById('A4').value=document.getElementById('AA4').value;
paper.submit();
}
</script>
<form name='paper' method="post" action="paper_over.asp?paperno=<%=paperno%>">


<INPUT TYPE="HIDDEN" ID="A1" VALUE="">
<INPUT TYPE="HIDDEN" ID="A2" VALUE="">
<INPUT TYPE="HIDDEN" ID="A3" VALUE="">
<INPUT TYPE="HIDDEN" ID="A4" VALUE="">
……
<input type="BUTTON" onclick="DoSubmit();" value="·提交·" name="B2" >
</form>

</body>
</html>
<!-- PersistentLayer-->
<input type='hidden' name='starttime' value='<%=Time()%>' size='20'>
<div id='persistMenu' style='position: absolute; height:170; width:166; left:830; top:106;z-index: 100; visibility: hidden' >
<table width="160" height="240" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="file:///G|/xychina24/exams/image/bg.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center" style="font-size:16; font-weight:bold">计 时 器</td>
</tr>
<tr>
<td height="160"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="15" style="font-size:12px">开始时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' ID="AA1" name='mystarttime' size='11' class="s01" readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">结束时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' ID="AA2" name='myendtime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">剩余时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' ID="AA3" name='lefttime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
<tr>
<td height="15" style="font-size:12px">现在时间:</td>
</tr>
<tr>
<td height="25" align="right"><input type='text' ID="AA4" name='xintime' size='11' class='s01' readonly style='text-align: center' ></td>
</tr>
</table></td>
</tr>
<tr>
<td height="40" align="center"><input type='submit' value='我要交卷' name='B3' class='s02' onclick='submitit(1)' style='color: #58595B'></td>
</tr>
</table></td>
</tr>
</table>
</div>
<script language='javascript'>
var mys=60*<%=shijian%>
MM_showHideLayers('persistMenu','','show');
ScrollMenu();
var now1 = new Date();
var hours1 = now1.getHours();
var minutes1 = now1.getMinutes();
var seconds1 = now1.getSeconds();
var timeValue1 = hours1 + ':' + minutes1 + ':' + seconds1
document.all.mystarttime.value=timeValue1;

minutes1=minutes1+<%=shijian%>
if(minutes1>60)
{
hours1=hours1+Math.floor(minutes1/60)
minutes1=minutes1%60
}

document.all.myendtime.value=hours1+':'+minutes1+':'+seconds1
//var kcid = <%=kcid%>
var paperno = <%=paperno%>
startclock();
var timerID = null;
var timerRunning = false;
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 timeValue = hours + ':' + minutes + ':' + seconds



mys=mys-1
var mym=Math.floor(mys /60)
var myh=0
if(mym>60)
{
myh=Math.floor(mym/60)
mym=mym%60
}
var sec=mys%60
document.all.xintime.value = timeValue
document.all.lefttime.value =myh+':'+mym+':'+sec;

if (mym<0)
{
if (mys<0)
{
alert('考试时间到,请提交您的试卷!');
paper.action="paper_over.asp?paperno=<%=paperno%>"
paper.submit();
}
}

zuihou();
zuihou1();
timerID = setTimeout('showtime()',1000);
timerRunning = true;
}
function startclock () {
stopclock();
showtime();
}
function zuihou(){
if (document.all.lefttime.value=='0:1:0')
{
alert('考试时间还剩1分钟,请检查答案,并提交试卷!');
}
}
function zuihou1(){
if (document.all.lefttime.value=='0:0:10')
{
alert('还剩10秒钟,请检查答案,并提交试卷!');
}
}
function submitit(id)
{
if (confirm('未到交卷时间,您确定要提前交卷么?'))
{
paper.action="paper_over.asp?paperno=<%=paperno%>"
paper.submit();
}
}
</script>
  • 打赏
  • 举报
回复
你不是有了标单了吗?后台直接读取就可以了啊
Atai-Lu 2008-10-14
  • 打赏
  • 举报
回复
<form name='paper' method="post" action="paper_over.asp?paperno=<%=paperno%>">

在这个form里套上隐藏表单,用js把开始时间,所用时间写入隐藏表单中,然后再提交

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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