...

View Full Version : Help with Price Change/Quote System



Mith
05-07-2004, 10:34 PM
Hey guys. This is my first post here, so please dont flame me. I'm doing this script where i need to have a bunch of radio buttons, and there be a dynamic display at the bottom. IT needs to change for the clicks on the radio buttons. Three groups of the buttons. The price also needs to be displayed in US Dollars and GB Pounds. Here is what i have so far:



nFormElements++;

function onClickItem(o)
{
nCurrentPrice = 0;

for (i=1;i<nFormElements;i++) {
for (x = 0; x < document.formprice["radio"+i].length; x++) {
if (document.formprice["radio"+i][x].checked) {
nCurrentPrice += parseInt(document.getElementById("label"+i+x).innerHTML.slice(1));
}
}
}
document.getElementById('Price').innerText = nCurrentPrice;
}


Thanks for your help. Speedy responses please.

Mith
05-08-2004, 04:51 AM
Ok, like 20 people have seen this. Does no one know how to do that?

swmr
05-08-2004, 06:47 AM
Thanks for your help. Speedy responses please.

Ok, like 20 people have seen this. Does no one know how to do that?

This is my first post here, so please dont flame me.

This is your first post here, Mith, so please don't flame us... :rolleyes:

Mith
05-08-2004, 02:41 PM
Lol. I guess your right. But now its bee like 1000 + so... I know there are some of you that can help.

swmr
05-08-2004, 02:51 PM
So, anyway... Welcome Mith, I have a more constructive suggestion to offer this time: ;)

Try describing exactly what you'd like to accomplish with those radio buttons, and include all of your current code -- along with the elements that your script is referencing.

Perhaps the price conversion should be opened as a separate topic...

Mith
05-08-2004, 04:08 PM
ok, well all the jscript is there. Here is the html. I just need for the price to change based upon witch radio button, in a group, is inFocus.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
nFormElements = 3;
//-->
</script>
<script src="javascript.js" type="text/javascript"></script>
<link rel="stylesheet" href="stylesheet.css" />
<title>Javascript Price Change</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="eFusian.co.uk" />
</head>
<body onload="javascript: document.getElementById('Price').innerText = 0;">
<form action="" name="formprice" method="post">
<!-- Question 1 Start -->
<p><span class="header">Number of Pages :</span> <br />
<br />

<input type="radio" name="radio1" value="1" onClick="javascript: onClickItem(this);" />
6 or Less
$70 GBP, $129 USD<br />
<input type="radio" name="radio1" value="2" onClick="javascript: onClickItem(this);" />
7 or More
$100 GBP, $184 USD <br />
<br />
<!-- Question 1 End -->
<!-- Question 2 Start -->
<span class="header">Dynamic Functions :</span> <br />
<br />

<input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
Login System $10 GBP, $18 USD <br />
<input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
Database $10 GBP, $18 USD<br />
<input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
Forum $10 GBP, $18 USD <br />
<input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
Shopping Cart $10 GBP, $18 USD <br />
<input type="radio" name="radio2" value="1" onClick="javascript: onClickItem(this);" />
Forms $10 GBP, $18 USD <br />
<input type="radio" name="radio2" value="2" onClick="javascript: onClickItem(this);" />
Any two $20 GBP, $36 USD <br />
<input type="radio" name="radio2" value="3" onClick="javascript: onClickItem(this);" />
Any three $30 GBP, $44 USD<br>
<input type="radio" name="radio2" value="3.5" onClick="javascript: onClickItem(this);" />
Any four $35 GBP, $50 USD<br>
<input type="radio" name="radio2" value="4" onClick="javascript: onClickItem(this);" />
All five $40 GBP, $55 USD<br />
<!-- Question 2 End -->
<!-- Question 3 Start -->
<span class="header"><br>
Would you like to buy hosting and domain through us?:</span> <br />
<br />

<input type="radio" name="radio3" value="2" onClick="javascript: onClickItem(this);" />
Yes <span id="label30">$20</span> <br />
<input type="radio" name="radio3" value="0" onClick="javascript: onClickItem(this);" />
No <span id="label31">$0</span><br />
<!-- Question 3 End -->
<br />
<br />
<!-- Display Price Start -->
<span class="large">Total Price: $</span><span id="Price" class="large"></span>
<!-- Displa Price End -->
</p>
</form>
</body>
</html>

I know its a bit messed up, but that is all ive got so far.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum