关闭

写了一个JS脚本.

1182人阅读 评论(0) 收藏 举报
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0025)http://127.0.0.1/test.asp -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>.unnamed1 {
     FONT-SIZE: 10pt; TEXT-DECORATION: none
}
</STYLE>
 
<FORM name=forms>
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<CENTER>
<DIV align=center><SPAN class=unnamed1>考试时间: <INPUT size=9 name=input1>
<SCRIPT language=javascript><!--
 
var sec=0;var min=0;var hou=0;flag=0;idt=window.setTimeout("update();",1000);function update(){sec++;if(sec==60){sec=0;min+=1;}if(min==60){min=0;hou+=1;}if((min>0)&&(flag==0)){flag=1;}
 
document.forms.input1.value=hou+"时"+min+"分"+sec+"秒";idt=window.setTimeout("update();",1000);}
//-->
 
</SCRIPT>
 </SPAN></DIV></CENTER></FORM>
<FORM id=FORM1 name=FORM1 action=result.asp method=post>
<P align=center><SPAN class=unnamed1></SPAN>
<P align=center><SPAN class=unnamed1>   可怜的小猪2 </SPAN></P>
<DIV align=center>
<TABLE borderColor=#0099ff cellSpacing=1 cellPadding=1 width="35%" align=center
border=1>
 <TBODY>
 <TR bgColor=#99ccff>
    <TD class=unnamed1 style="WIDTH: 50%" width="49%"><INPUT type=radio
      value=A name=ans1> 没有原因 </TD></TR>
 <TR bgColor=#ccccff>
    <TD class=unnamed1 width="49%"><INPUT type=radio value=B name=ans1> 原因错误
    </TD></TR>
 <TR bgColor=#99ccff>
    <TD class=unnamed1 width="51%"><INPUT type=radio value=C name=ans1> 的确错误
    </TD></TR>
 <TR bgColor=#ccccff>
    <TD class=unnamed1 width="49%"><INPUT type=radio value=D name=ans1> 真的错误
    </TD></TR></TBODY></TABLE><SPAN class=unnamed1></SPAN>
<P align=center><SPAN class=unnamed1>   第二题 </SPAN></P>
<DIV align=center>
<TABLE borderColor=#0099ff cellSpacing=1 cellPadding=1 width="35%" align=center
border=1>
 <TBODY>
 <TR bgColor=#99ccff>
    <TD class=unnamed1 style="WIDTH: 50%" width="49%"><INPUT type=radio
      value=A name=ans2> 1 </TD></TR>
 <TR bgColor=#ccccff>
    <TD class=unnamed1 width="49%"><INPUT type=radio value=B name=ans2 ID=ans2> 2
 </TD></TR>
 <TR bgColor=#99ccff>
    <TD class=unnamed1 width="51%"><INPUT type=radio value=C name=ans2 ID=ans2> 3
 </TD></TR>
 <TR bgColor=#ccccff>
    <TD class=unnamed1 width="49%"><INPUT type=radio value=D name=ans2 ID=ans2> 4
 </TD></TR></TBODY></TABLE><SPAN class=unnamed1></SPAN></DIV>
<DIV align=center><SPAN class=unnamed1>
<P></P></SPAN></DIV>
<P align=center> </P>
<P align=center><SPAN class=unnamed1><INPUT id=submit1 name=submit1 type=submit value="提交" onclick="return chkradio()"> <INPUT id=reset1 type=reset value=重填 name=reset1> </SPAN></P></FORM>
<DIV align=center><SPAN class=unnamed1></SPAN></DIV></DIV></BODY></HTML>
<script language="Javascript">
       function chkradio(){
              var p = 3;
              for (j=1;j<p;j++){
                     var aa = document.getElementsByName("ans"+[j]);
                     var ischecked = 0;
                     for (i=0;i<aa.length;++i){
                            if (aa[i].checked==true){
                                   ischecked = 1;
                                   break;
                            }
                     }
                     if (ischecked ==0){
                            alert("第"+(j)+"题没有被选中")
                            return false;
                     }    
              }
              return true;
       }
</script>
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:162025次
    • 积分:2384
    • 等级:
    • 排名:第15666名
    • 原创:66篇
    • 转载:12篇
    • 译文:0篇
    • 评论:33条
    最新评论
    BLOG链接