复制代码代码如下:
<!doctype html>
<html>
<head>
<title> mycart1.html </title>
<meta http-equiv = "keywords" content = "keyword2、keyword3">
<メタhttp-equiv = "description" content = "これは私のページ">
<meta http-equiv = "content-type" content = "text/html; charset = utf-8">
<! - <link rel = "styleSheet" type = "text/css" href = "./ styles.css"> - >
<スクリプト言語= "javascript" type = "text/javascript">
関数jisuan(obj){
var total = 0;
var fruits = document.getElementsByname( "Fruit");
for(var i = 0; i <fruits.length; i ++){
if(fruits [i] .Checked){
Total += parsefloat(fruits [i] .value);
}
}
myspan.innertext =合計 + "元";
}
</script>
</head>
<body>
<入力型= "チェックボックス" name = "furt" value = "10" onclick = "jisuan(this)">苹果10元<br/>
<入力型= "チェックボックス" name = "furt" value = "20" onclick = "jisuan(this)">香蕉20元<br/>
<入力タイプ= "チェックボックス" name = "furt" value = "30" onclick = "jisuan(this)">西瓜30元<br/>
<入力型= "チェックボックス" name = "furt" value = "40" onclick = "jisuan(this)">栗子40元<br/>
<入力型= "チェックボックス" name = "furd" value = "50" onclick = "jisuan(this)">哈密瓜50元<br/> <br/>
总价格是:<span id = "myspan"> 0元</span>
</body>
</html>