Copy Code code as follows:
<! DOCTYPE html>
<title>MyCart1.html</title>
<meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
<meta http-equiv= "description" content= "This are my page" >
<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" >
function 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 = Total + "Yuan";
}
</script>
<body>
<input type = "checkbox" name = "Fruit" value = "ten" onclick = "Jisuan (this)" > Apple 10 $ <br/>
<input type = "checkbox" name = "Fruit" value = "onclick" = "Jisuan (this)" > Banana 20 $ <br/>
<input type = "checkbox" name = "Fruit" value = "onclick" = "Jisuan (this)" > Watermelon 30 Yuan <br/>
<input type = "checkbox" name = "Fruit" value = "m" onclick = "Jisuan (this)" > Chestnut 40 Yuan <br/>
<input type = "checkbox" name = "Fruit" value = "button" onclick = "Jisuan (this)" > Cantaloupe 50 <br/><br/>
The total price is: <span id = "MySpan" >0 </span>
</body>