<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>表格合计</title> </head> <body> <table border="1"> <tr> <td colspan="2" width="200px"><h2>刊物类别</h2></td> <td colspan="5" width="300px"><h2>量化标准及积分</h2></td> </tr> <tr> <tr> <td cospan="2" width="200px"> 期刊选择 </td> <td colspan="2" width="100px"> <select width="100%" id="checkType" οnchange="changeCheckType();" οnchange="Sumnum"> <option value="1">science</option> <option value="2">nature</option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo" style=" border: none"></input> </td> </tr> <tr> <td colspan="2" width="200px">国内期刊</td> <td colspan="2" width="100px"> <select width="100%" id="checkType1" οnchange="changeCheckType1();" οnchange="Sumnum"> <option value="3">A类</option> <option value="4">B类</option> <option value="5">C类</option> <option value="6">D类</option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo1" style=" border: none"></input> </td> </tr> <tr> <td colspan="2" width="200px">SSCI</td> <td colspan="2" width="100px"> <select width="100%" id="checkType2" οnchange="changeCheckType2();" οnchange="Sumnum"> <option value="7"> ≤6</option> <option value="8">≥3≤6</option> <option value="9">≥1≤3</option> <option value="10">≤1</option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo2" style=" border: none"></input> </td> </tr> <tr> <td colspan="2" width="200px">SCI</td> <td colspan="2" width="100px"> <select width="100%" id="checkType3" οnchange="changeCheckType3();" οnchange="Sumnum"> <option value="11"> 1区</option> <option value="12">2区</option> <option value="13">3区</option> <option value="14">4区</option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo3" style=" border: none"></input> </td> </tr> <tr> <td colspan="2" width="200px">EI</td> <td colspan="2" width="100px"> <select width="100%" id="checkType4" οnchange="changeCheckType4();" οnchange="Sumnum"> <option value="15"> 源刊</option> <option value="16">会议收录</option> <option value="17">CPCI-S&SSH-ASP</option> <option value="18">A&HCP</option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo4" style=" border: none"></input> </td> </tr> <tr> <td colspan="2" width="200px">期刊</td> <td colspan="2" width="100px"> <select width="100%" id="checkType5" οnchange="changeCheckType5();" οnchange="Sumnum" > <option value="20">期刊</option> <option value="21">铜仁学院报<option> </select> </td> <td colspan="4" width="100px"> <input id="checkTypeInfo5" style=" border: none"> </td> </tr> <tr> <td colspan="2" width="200px">总计</td> <td colspan="4" width="200px"> <input id="checkTypeInfo6" style=" border: none"> </input> </td> </tr> </table> <script type="text/javascript"> var cti1 = document.getElementById('checkTypeInfo'); function changeCheckType(){ var ct = document.getElementById("checkType"); var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="1"){ cti1.value="300"; } if(sv=="2"){ cti1.value="1200"; }Sumnum();} var cti2 = document.getElementById("checkTypeInfo1"); function changeCheckType1(){ var ct = document.getElementById("checkType1"); var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="3"){ cti2.value="900"; } if(sv=="4"){ cti2.value="600"; } if(sv=="5"){ cti2.value="300"; } if(sv=="6"){ cti2.value="200"; }Sumnum(); } var cti3 = document.getElementById("checkTypeInfo2"); function changeCheckType2(){ var ct = document.getElementById("checkType2"); var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="7"){ cti3.value="900"; } if(sv=="8"){ cti3.value="600"; } if(sv=="9"){ cti3.value="300"; } if(sv=="10"){ cti3.value="200"; }Sumnum(); } var cti4 = document.getElementById("checkTypeInfo3"); function changeCheckType3(){ var ct = document.getElementById("checkType3"); var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="11"){ cti4.value="900"; } if(sv=="12"){ cti4.value="600"; } if(sv=="13"){ cti4.value="300"; } if(sv=="14"){ cti4.value="200"; }Sumnum(); } function changeCheckType4(){ var cti5 = document.getElementById("checkTypeInfo4"); var ct = document.getElementById("checkType4");//拿到索引 var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="15"){ cti5.value="200"; } if(sv=="16"){ cti5.value="60"; } if(sv=="17"){ cti5.value="60";} if(sv=="18"){ cti5.value="60"; } if(sv=="19"){ cti5.value="200"; } Sumnum(); } function changeCheckType5(){ var cti6 = document.getElementById("checkTypeInfo5"); var ct = document.getElementById("checkType5");//定位ID var index = ct.selectedIndex; var sv = ct.options[index].value; if(sv=="20"){ cti6.value="200"; } if(sv=="21"){ cti6.value="200"; } } var num=document.getElementById("checkTypeInfo"); var num1=document.getElementById("checkTypeInfo1"); var num2=document.getElementById("checkTypeInfo2"); var num3=document.getElementById("checkTypeInfo3"); var num4=document.getElementById("checkTypeInfo4"); var num5=document.getElementById("checkTypeInfo5"); var checkType6=document.getElementById("checkTypeInfo6").value; var btn = document.getElementById("bt"); // btn.οnclick=functon(){ // alert("请再次选择累加"); // count(); // } function Sumnum(){ var a=0,a1=0 ,a2=0,a3=0,a4=0,a5=0; if((num!=null)&&(num.value!="")){ a=Number.parseFloat(num.value); } if((num1!=null)&&(num1.value!="")){ a1=Number.parseFloat(num1.value); } if((num2!=null)&&(num2.value!="")){ a2=Number.parseFloat(num2.value); } if((num3!=null)&&(num3.value!="")){ a3=Number.parseFloat(num3.value); } if((num4!=null)&&(num4.value!="")){ a4=Number.parseFloat(num4.value); } if((num5!=null)&&(num5.value!="")){ a5=Number.parseFloat(num5.value); } var sum0=a+a1+a2+a3+a4+a5; document.getElementById("checkTypeInfo6").value=sum0;} </script> </body> </html>
表格的自动计算功能
最新推荐文章于 2024-10-15 23:14:50 发布