先补上函数,格式化数据的问题待会再说
<script>
function bb() {
f = document.form1;
a=0;
for(i=0;i<f.a.length;i++)
if(f.a[i].checked)
a = f.a[i].value;
b=0;
for(i=0;i<f.b.length;i++)
if(f.b[i].checked)
b = f.b[i].value;
c=0;
for(i=0;i<f.c.length;i++)
if(f.c[i].checked)
c = f.c[i].value;
d = (a*20+b*20+c*60)/100;
f.d.value = d;
}
</script>
<script>
function bb() {
f = document.form1;
a=0;
for(i=0;i<f.a.length;i++)
if(f.a[i].checked)
a = f.a[i].value;
b=0;
for(i=0;i<f.b.length;i++)
if(f.b[i].checked)
b = f.b[i].value;
c=0;
for(i=0;i<f.c.length;i++)
if(f.c[i].checked)
c = f.c[i].value;
d = (a*20+b*20+c*60)/100;
f.d.value = d;
}
</script>
<form name="form1" method="post" action="">
<div align="center"><br>
</div>
<table width="70%" height="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" class="font14b">
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"><strong>评估项目</strong></td>
<td height="20">很好=5、好=4、可=3、需改进=2、不好=1</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20">1、开场白</td>
<td height="20"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 一开始就能使大家集中注意力</td>
<td height="20"> <input type="radio" name="a" value="5">
5分
<input type="radio" name="a" value="4">
4分
<input type="radio" name="a" value="3">
3分
<input type="radio" name="a" value="2">
2分
<input type="radio" name="a" value="1">
1分 20</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 问候及自我介绍 </td>
<td height="20"> <input type="radio" name="b" value="5" >
5分
<input type="radio" name="b" value="4">
4分
<input type="radio" name="b" value="3">
3分
<input type="radio" name="b" value="2">
2分
<input type="radio" name="b" value="1">
1分 20</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 提到主题、大纲 </td>
<td height="20"> <input type="radio" name="c" value="5">
5分
<input type="radio" name="c" value="4">
4分
<input type="radio" name="c" value="3">
3分
<input type="radio" name="c" value="2">
2分
<input type="radio" name="c" value="1">
1分 60</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20">点击小计:<br></td>
<td height="20"><input name="d" type="text" id="d" > <input type="button" value="点击小计" onclick="bb()"> </td>
</tr>
</table>
</form><script>
function bb()
{
var aa,bb,cc
for(i=0;i<document.form1.a.length;i++)
{
if(document.form1.a[i].checked) aa=document.form1.a[i].value
}
for(i=0;i<document.form1.b.length;i++)
{
if(document.form1.b[i].checked) bb=document.form1.b[i].value
}
for(i=0;i<document.form1.c.length;i++)
{
if(document.form1.c[i].checked) cc=document.form1.c[i].value
}
document.form1.d.value=tofloat((parseFloat(aa,10)*20+parseFloat(bb,10)*20+parseFloat(cc,10)*60)/100,2)}
function tofloat(f,dec) {
if(dec<0) return "Error:dec<0!";
result=parseInt(f)+(dec==0?"":".");
f-=parseInt(f);
if(f==0)
for(i=0;i<dec;i++) result+='0';
else {
for(i=0;i<dec;i++) f*=10;
result+=parseInt(Math.round(f));
}
return result;
} </script>
<form name="form1" method="post" action="">
<div align="center"><br>
</div>
<table width="70%" height="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#000000" class="font14b">
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"><strong>评估项目</strong></td>
<td height="20">很好=5、好=4、可=3、需改进=2、不好=1</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20">1、开场白</td>
<td height="20"> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 一开始就能使大家集中注意力</td>
<td height="20"> <input type="radio" name="a" value="5">
5分
<input type="radio" name="a" value="4">
4分
<input type="radio" name="a" value="3">
3分
<input type="radio" name="a" value="2">
2分
<input type="radio" name="a" value="1">
1分 20</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 问候及自我介绍 </td>
<td height="20"> <input type="radio" name="b" value="5" >
5分
<input type="radio" name="b" value="4">
4分
<input type="radio" name="b" value="3">
3分
<input type="radio" name="b" value="2">
2分
<input type="radio" name="b" value="1">
1分 20</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20"> 提到主题、大纲 </td>
<td height="20"> <input type="radio" name="c" value="5">
5分
<input type="radio" name="c" value="4">
4分
<input type="radio" name="c" value="3">
3分
<input type="radio" name="c" value="2">
2分
<input type="radio" name="c" value="1">
1分 60</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="40%" height="20">点击小计:<br></td>
<td height="20"><input name="d" type="text" id="d" > <input type="button" value="点击小计" onclick="bb()"> </td>
</tr>
</table>
</form><script>
function bb()
{
var a=0,bb=0,cc=0
for(i=0;i<document.form1.a.length;i++)
{
if(document.form1.a[i].checked) aa=document.form1.a[i].value
}
for(i=0;i<document.form1.b.length;i++)
{
if(document.form1.b[i].checked) bb=document.form1.b[i].value
}
for(i=0;i<document.form1.c.length;i++)
{
if(document.form1.c[i].checked) cc=document.form1.c[i].value
}
document.form1.d.value=tofloat((parseFloat(aa,10)*20+parseFloat(bb,10)*20+parseFloat(cc,10)*60)/100,2)}
function tofloat(f,dec) {
if(dec<0) return "Error:dec<0!";
result=parseInt(f)+(dec==0?"":".");
f-=parseInt(f);
if(f==0)
for(i=0;i<dec;i++) result+='0';
else {
for(i=0;i<dec;i++) f*=10;
result+=parseInt(Math.round(f));
}
return result;
} </script>