Jump to content

onchange no longer works?


jasonc

Recommended Posts

below is part of the code that does not work, i have placed it into a new file and tried to get it to work

when one option is selected the other clears back to '0' and vise versa.

it did work at one point but something is wrong now can not see what it is myself

can anyone spot what is missing or wrong?

thanks




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form" method="post" action="">
<select onchange=form.banana.value=0; form.bananaLB.value=0; name=bananaKG>
<option selected value=0>0kg</option><option value=1>1kg</option><option value=2>2kg</option>
<option value=3>3kg</option><option value=4>4kg</option><option value=5>5kg</option>
<option value=6>6kg</option><option value=7>7kg</option><option value=8>8kg</option>
<option value=9>9kg</option><option value=10>10kg</option></select>
<br>
<select onchange=form.banana.value=0; form.bananaKG.value=0; name=bananaLB>
<option selected value=0>0lb</option><option value=1>1lb</option><option value=2>2lb</option>
<option value=3>3lb</option><option value=4>4lb</option><option value=5>5lb</option>
<option value=6>6lb</option><option value=7>7lb</option><option value=8>8lb</option>
<option value=9>9lb</option><option value=10>10lb</option></select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
Link to comment
Share on other sites

[!--quoteo(post=356483:date=Mar 19 2006, 08:29 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 19 2006, 08:29 PM) [snapback]356483[/snapback][/div][div class=\'quotemain\'][!--quotec--]
What are you trying to do? Cause you've programmed it to set to zero on each change:

[code]onchange=form.banana.value=0; form.bananaLB.value=0;[/code]
[/quote]


if option one selected option two is set to '0' if option two is selected option one is set to '0'

option one is bananaKG option two is bananaLB

ignor the 'banana.value=0' this is for a third option if needed.

has no effect at the moment.

i select one and it should clear the other but it doesn't it keeps it value.

Link to comment
Share on other sites

[code]<body>
<form name="form" method="post" name="banana" action="">
<select onchange="form.bananaLB.selectedIndex=0;" name=bananaKG>
<option selected value=0>0kg</option><option value=1>1kg</option><option value=2>2kg</option>
<option value=3>3kg</option><option value=4>4kg</option><option value=5>5kg</option>
<option value=6>6kg</option><option value=7>7kg</option><option value=8>8kg</option>
<option value=9>9kg</option><option value=10>10kg</option></select>
<br>
<select onchange="form.bananaKG.selectedIndex=0;" name=bananaLB>
<option selected value=0>0lb</option><option value=1>1lb</option><option value=2>2lb</option>
<option value=3>3lb</option><option value=4>4lb</option><option value=5>5lb</option>
<option value=6>6lb</option><option value=7>7lb</option><option value=8>8lb</option>
<option value=9>9lb</option><option value=10>10lb</option></select>
<input type="submit" name="Submit" value="Submit">
</form>
</body>[/code]
Link to comment
Share on other sites

below is the code that is created by the php file.

<form method="POST" action="orderpage.php">
<input name="submit" type="submit" value="Log Out">

<table border="3">
<tr width=\"100%\">
<td width="204" align="center"><img border=0 src="fruit and veg images/banana.jpg"><br>
<table width=200 border=0>
<tr>
<td><div align="center">banana</div></td>
</tr>
</table>
<br>
1.00p kg<br>
(0.45p lb *)<br>
Required Weight in kgs
<select onchange="form.banana.value=0; form.bananaLB.value=0;" name=bananaKG>
<option selected value=0>0kg</option>
<option value=1>1kg</option>
<option value=2>2kg</option>
<option value=3>3kg</option>
<option value=4>4kg</option>
<option value=5>5kg</option>
<option value=6>6kg</option>
<option value=7>7kg</option>
<option value=8>8kg</option>
<option value=9>9kg</option>
<option value=10>10kg</option>
</select> <br>
Required Weight in lbs
<select onchange="form.banana.value=0; form.bananaKG.value=0;" name=bananaLB>
<option selected value=0>0lb</option>
<option value=1>1lb</option>
<option value=2>2lb</option>
<option value=3>3lb</option>
<option value=4>4lb</option>
<option value=5>5lb</option>
<option value=6>6lb</option>
<option value=7>7lb</option>
<option value=8>8lb</option>
<option value=9>9lb</option>
<option value=10>10lb</option>
</select> </td>
</tr>
</table>
<p><input type="submit" value="Preview Order" name="submit"><input type="submit" value="Reset" name="submit"></p></form>note about buying by LB's and if buying by item when it is sold by weight it is going to be around that weight and should not be sold at the stated price until it is weight correctly in KG.
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.