日期:2014-05-16 浏览次数:20322 次
<script type="text/javascript"> var test={ "A":1, "B":2, "C":3, "D":4 } function TEST(value){ var length=value.length; var count=0; for(var i=0;i<length;i++){ var subvalue=value[i]; if(typeof test[subvalue]!="undefined"){ count+=test[subvalue] } } return count } document.write(TEST("ABCDAA"));//12 </script>