Jump to content

Help plz! Checkbox calculator - i'm stuck!


MadsMol

Recommended Posts

Hi. Well. Must admit, i'm a n00b. But i still need your help for something.

I want to make a list with several different subjects, let's say it's a .. iPad, a Cellphone, a TV and maybe .. a car ..

If people want to buy a iPad and a car, they check the checkbox, press "show me the price" and there's the price .. but i can't get it to work with checkboxes :(

I found this in here, but can't get it "changed" to textboxes .. so please - anyone - help!

 


<html>
<body>
<script>
function add()
{
var x = document.getElementById("txt1").value;
var y = document.getElementById("txt2").value;
document.getElementById("sum").value =(x*1)+(y*1);
}
</script>
<form name="frm1">
<input type="text" id="txt1" value="5"> + <input type="text" id="txt2" value="10"><input type="button" value="Add" onclick="add()">
sum<input type="text" id="sum">
</form>
</body>
</html>

 

Let's play that txt1 is the iPad and txt2 is the car .. How do i change those textboxes into checkboxes?

Link to comment
https://forums.phpfreaks.com/topic/266222-help-plz-checkbox-calculator-im-stuck/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.