Click to See Complete Forum and Search --> : help please with cross platform problem from newbie


MadMax22
11-08-2003, 03:52 AM
I needed to make an automatic display of a product price dependant upon what product attributes was selected,
the output is not required to be passed on, as the php scripting covers that later,
(a bit of a feature creep I must admit),
the javascript code i wrote is proberly wrong, but it works in IE Mozilla and netscape and Galeaon,
but not Opera or Konquer,
could someone please help with it, or suggest a better way of doing it that would be any browser complient
Note: The select fields are dynamic so there may be none or 1000's
hence why the A= would be generated from php upon display
and if more are required then they are incremented A1.
also all the attribute select lists are bundeled into an array
the option values value="Red=+1.25" are taken straight from the database which is way they are in that format,
basicly to save another sql qurey to get the additional cost of selected attribute
and to pass on the name and value of selected attribute
<html>
<head>
</head>
<body>
<script language="JavaScript">
function showpay() {
base=eval("15.25")
A=eval(document.calc.att.value)
A1=eval(document.calc.att1.value)
total=base+A+A1
document.getElementById('price').innerHTML = total.toFixed(2)
}
</script>
<font class="twscart-normal">£</font><font id="price" class="twscart-normal"></font>
<form name=calc method=POST action="somwhere.php">
Size:<select name="att[Size]" id="att" onChange="showpay()">
<option value="Small=+0">Small</option>
<option value="Medium=+0.25">Medium + £0.25</option>
<option value="Large=+0.50">Large + £0.50</option>
<option value="XLarge=+0.75">XLarge + £0.75</option>
<option value="XXLarge=+4.75">XXLarge + £4.75</option>
</select><br>
Colour:<select name="att[Colour]" id="att1" onChange="showpay()">
<option value="Red=+0">Red</option>
<option value="Blue=+0.25">Blue + £0.25</option>
<option value="Green=+0.50">Green + £0.50</option>
<option value="Black=+0.75">Black + £0.75</option>
<option value="White=+4.75">White + £1.75</option>
</select><br>
<input type="submit" value="add to cart">
</form>
<script language="JavaScript">showpay();</script>
</body>
</html>

any help most appriciated