标题:
求助!JavaScript,不会了
[打印本页]
作者:
jiyangonline
时间:
2006-4-19 13:56
标题:
求助!JavaScript,不会了
1 生动 富于冒险 善于分析 适应力强
2 喜好娱乐 善于说服 坚持不懈 和平
3 善于社交 意志坚定 自我牺牲 顺服
4 令人信服 竞争性 体贴 自控性
5 使人振作 反应敏捷 受尊重 含蓄
6 生机勃勃 自立 敏感 满足
7 推动者 积极 计划者 耐性
8 无拘无束 肯定 按部就班 羞涩
9 乐观 坦率 井井有条 迁就
10 有趣 强迫性 忠诚 友善
共十行,每一行有四种选择,只能选一个,单选
例对于第三个
3 善于社交 意志坚定 自我牺牲 顺服
只能选择上述4个中的一个.
提交前,检验是否每行选择了一个,总选中数是否是10个.
统计分数,
每个选择1分,总分一定是10分.
但是:要求统计每一列被选中的个数,得到四个列的选中个数,
例:第一列选中3;第二列选中1个; 第三列选中5;第四列选中1个
分数为 3 1 5 1 总分10分
作者:
woaiLZ
时间:
2006-4-19 13:57
<script>
function count(){
var a=[0,0,0,0]
for(i=1;i<=10;i++){
var r=document.getElementsByName("radiobutton"+i)
var n=0
for(j=0;j<r.length;j++){
if(r[j].checked){
n++
a[j]++
}
}
}
for(k=0;k<a.length;k++)eval("r"+k).innerHTML=a[k]
}
</script>
<form action="" method="post" name="form1" onsubmit="return false">
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td>说明:在以下各行的词语中,用"" 在最使我们词语前作记号,要做完10题,不要漏掉任何一题,若你不能肯定哪个是"最合适",请想想:当你还是小孩的时候,哪个该是正确答案.</td>
</tr>
</table>
<table width="80%" border="1" align="center" cellpadding="3" cellspacing="0" bordercolorlight="#FFFFFF" bordercolordark="#000000">
<tr>
<td>1</td>
<td> <input type="radio" name="radiobutton1" value="radiobutton"> </td>
<td>生动</td>
<td> <input type="radio" name="radiobutton1" value="radiobutton"> </td>
<td>富于冒险</td>
<td> <input type="radio" name="radiobutton1" value="radiobutton"> </td>
<td>善于分析</td>
<td> <input type="radio" name="radiobutton1" value="radiobutton"> </td>
<td>适应力强</td>
</tr>
<tr>
<td>2</td>
<td> <input type="radio" name="radiobutton2" value="radiobutton"> </td>
<td>喜好娱乐</td>
<td> <input type="radio" name="radiobutton2" value="radiobutton"> </td>
<td>善于说服</td>
<td> <input type="radio" name="radiobutton2" value="radiobutton"> </td>
<td>坚持不懈</td>
<td> <input type="radio" name="radiobutton2" value="radiobutton"> </td>
<td>和平</td>
</tr>
<tr>
<td>3</td>
<td> <input type="radio" name="radiobutton3" value="radiobutton"> </td>
<td>善于社交</td>
<td> <input type="radio" name="radiobutton3" value="radiobutton"> </td>
<td>意志坚定</td>
<td> <input type="radio" name="radiobutton3" value="radiobutton"> </td>
<td>自我牺牲</td>
<td> <input type="radio" name="radiobutton3" value="radiobutton"> </td>
<td>顺服</td>
</tr>
<tr>
<td>4</td>
<td> <input type="radio" name="radiobutton4" value="radiobutton"> </td>
<td>令人信服</td>
<td> <input type="radio" name="radiobutton4" value="radiobutton"> </td>
<td>竞争性</td>
<td> <input type="radio" name="radiobutton4" value="radiobutton"> </td>
<td>体贴</td>
<td> <input type="radio" name="radiobutton4" value="radiobutton"> </td>
<td>自控性</td>
</tr>
<tr>
<td>5</td>
<td> <input type="radio" name="radiobutton5" value="radiobutton"> </td>
<td>使人振作</td>
<td> <input type="radio" name="radiobutton5" value="radiobutton"> </td>
<td>反应敏捷</td>
<td> <input type="radio" name="radiobutton5" value="radiobutton"> </td>
<td>受尊重</td>
<td> <input type="radio" name="radiobutton5" value="radiobutton"> </td>
<td>含蓄</td>
</tr>
<tr>
<td>6</td>
<td> <input type="radio" name="radiobutton6" value="radiobutton"> </td>
<td>生机勃勃</td>
<td> <input type="radio" name="radiobutton6" value="radiobutton"> </td>
<td>自立</td>
<td> <input type="radio" name="radiobutton6" value="radiobutton"> </td>
<td>敏感</td>
<td> <input type="radio" name="radiobutton6" value="radiobutton"> </td>
<td>满足</td>
</tr>
<tr>
<td>7</td>
<td> <input type="radio" name="radiobutton7" value="radiobutton"> </td>
<td>推动者</td>
<td> <input type="radio" name="radiobutton7" value="radiobutton"> </td>
<td>积极</td>
<td> <input type="radio" name="radiobutton7" value="radiobutton"> </td>
<td>计划者</td>
<td> <input type="radio" name="radiobutton7" value="radiobutton"> </td>
<td>耐性</td>
</tr>
<tr>
<td>8</td>
<td> <input type="radio" name="radiobutton8" value="radiobutton"> </td>
<td>无拘无束</td>
<td> <input type="radio" name="radiobutton8" value="radiobutton"> </td>
<td>肯定</td>
<td> <input type="radio" name="radiobutton8" value="radiobutton"> </td>
<td>按部就班</td>
<td> <input type="radio" name="radiobutton8" value="radiobutton"> </td>
<td>羞涩</td>
</tr>
<tr>
<td>9</td>
<td> <input type="radio" name="radiobutton9" value="radiobutton"> </td>
<td>乐观</td>
<td> <input type="radio" name="radiobutton9" value="radiobutton"> </td>
<td>坦率</td>
<td> <input type="radio" name="radiobutton9" value="radiobutton"> </td>
<td>井井有条</td>
<td> <input type="radio" name="radiobutton9" value="radiobutton"> </td>
<td>迁就</td>
</tr>
<tr>
<td>10</td>
<td> <input type="radio" name="radiobutton10" value="radiobutton"> </td>
<td>有趣</td>
<td> <input type="radio" name="radiobutton10" value="radiobutton"> </td>
<td>强迫性</td>
<td> <input type="radio" name="radiobutton10" value="radiobutton"> </td>
<td>忠诚</td>
<td> <input type="radio" name="radiobutton10" value="radiobutton"> </td>
<td>友善</td>
</tr>
</table>
<table width="80%" border="1" bordercolordark="#000000" bordercolorlight="#FFFFFF" align="center" cellpadding="5" cellspacing="0">
<tr>
<td width="5%">总分:</td>
<td width="23%" id=r0>第一列选中的个数</td>
<td width="26%" id=r1>第二列选中的个数</td>
<td width="23%" id=r2>第三列选中的个数</td>
<td width="23%" id=r3>第四列选中的个数</td>
</tr>
</table>
<table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td align="center"><input type="submit" name="Submit" value="提交结果" onclick="count()">
<input type="submit" name="Submit2" value="重选">
</td>
</tr>
</table>
</form>
欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/)
Powered by Discuz! 6.0.0