日期:2014-05-16  浏览次数:20328 次

奇怪问题,弄明白了你也有收获
想实现点击每个项value= "F "实现相应项目扣分,并显示出对应项的总分
问题:
1。发现function()中k的值总是3,也就是说function中k的值是最后的3而不是
循环依次取得1,2,3

2。还有问题,这段在ie中有扣分结果,在firefox没有结果。不知道为什么


如果想实现功能,这段Js还能怎么写?

请高手指点~~~
<!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>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=utf-8 "   />
<script   src= "js/prototype.js "   type= "text/javascript "> </script>  
<title> 无标题文档 </title>
</head>

<body>
<form   id= "form1 "   name= "form1 "   method= "post "   action= " ">
    <div   id= "A1 ">
    <input   type= "radio "   name= "a "   value= "T "   />
    <input   type= "radio "   name= "a "   value= "F "   />
        <input   type= "radio "   name= "b "   value= "T "   />
    <input   type= "radio "   name= "b "   value= "F "   />
        <input   type= "radio "   name= "c "   value= "T "   />
    <input   type= "radio "   name= "c "   value= "F "   />
    </div>
        <div   id= "A2 ">
    <input   type= "radio "   name= "d "   value= "T "   />
    <input   type= "radio "   name= "d "   value= "F "   />
        <input   type= "radio "   name= "e "   value= "T "   />
    <input   type= "radio "   name= "e "   value= "F "   />
        <input   type= "radio "   name= "f "   value= "T "   />
    <input   type= "radio "   name= "f "   value= "F "   />
    </div>
    <div   id= "A3 ">
    <input   type= "radio "   name= "g "   value= "T "   />
    <input   type= "radio "   name= "g "   value= "F "   />
        <input   type= "radio "   name= "h "   value= "T "   />
    <input   type= "radio "   name= "h "   value= "F "   />
        <input   type= "radio "   name= "i "   value= "T "   />
    <input   type= "radio "   name= "i "   value= "F "   />
    </div>