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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.