复制代码代码如下:
<! doctype html>
<html>
<head>
<title> mycart1.html </itlem>
<meta http-equiv = "الكلمات الرئيسية" content = "Keyword1 ، Keyword2 ، Keyword3">
<meta http-equiv = "description" content = "This is is my past">
<meta http-equiv = "content-type" content = "text/html ؛ charset = utf-8">
<!-<link rel = "stylesheet" type = "text/css" href = "./ Styles.css">->
<script language = "javaScript" type = "text/javaScript">
وظيفة jisuan (obj) {
var total = 0 ؛
var fruits = document.getElementSbyName ("fruit") ؛
لـ (var i = 0 ؛ i <fruits.length ؛ i ++) {
if (ثمار [i]. تحقق) {
المجموع += parsefloat (الفواكه [i]. value) ؛
}
}
myspan.innertext = total + "元" ؛
}
</script>
</head>
<body>
<type type = "checkbox" name = "fruit" value = "10" onClick = "jisuan (this)"> 苹果 10 元 <br/>
<type type = "checkbox" name = "fruit" value = "20" onClick = "jisuan (this)"> 香蕉 20 元 <br/>
<type type = "checkbox" name = "fruit" value = "30" onClick = "jisuan (this)"> 西瓜 30 元 <br/>
<type type = "checkbox" name = "fruit" value = "40" onClick = "jisuan (this)"> 栗子 40 元 <br/>
<type type = "checkbox" name = "fruit" value = "50" onClick = "jisuan (this)"> 哈密瓜 50 元 <br/> <br/>
: : <span id = "myspan"> 0 元 </span>
</body>
</html>