<div class="codetitle"> <span><a style="CURSOR: pointer" data="45444" class="copybut" id="copybut45444" onclick="doCopy('code45444')"><u>复代码</u></a></span> 代码如下:</div> <div class="codebody" id="code45444"> <br><!DOCTYPE html> <br><html> <br><머리> <br><title>MyCart1.html</title> <br><br><meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <br><meta http-equiv="description" content="내 페이지입니다"> <br><meta http-equiv="content-type" content="text/html; charset=UTF-8"> <br><br><!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <br><스크립트 언어 = "javascript" type = "text/javascript"> <br><br>function jisuan(obj){ <br><br>var total = 0; <br>var Fruits = document.getElementsByName("과일"); <br>for(var i=0;i<fruits.length;i ){ <BR>if(fruits[i].checked){ <BR>total =parseFloat(fruits[i].value); <BR>} <BR>} <BR>myspan.innerText = 총 "원"; <BR>} <BR></script> <br></head> <br><br><본문> <br><input type = "checkbox" name = "fruit" value = "10" onclick = "jisuan(this)">苹果 10원<br/> <br><input type = "checkbox" name = "fruit" value = "20" onclick = "jisuan(this)">향초 20원<br/> <br><input type = "checkbox" name = "fruit" value = "30" onclick = "jisuan(this)">西瓜 30yuan<br/> <br><입력 유형 = "체크박스" 이름 = "과일" 값 = "40" onclick = "지수안(this)">栗子 40원<br/> <br><input type = "checkbox" name = "fruit" value = "50" onclick = "jisuan(this)">哈密瓜 50yuan<br/><br/> <br>总价格是:<span id = "myspan">0원</span> <br></body> <br></html> <br> </div> <br><img src="http://files.jb51.net/file_images/article/201401/20140126155233.png?201402615533" alt="장바구니_javascript 스킬 선택 후 가격 가져오기 예시" >