charon
10-03-2002, 08:03 AM
hi,
I have two Select objects -> Property and Price, whereby the price will be listed in the Price Select tag base on the property type. For example:
<select name="property" onChange="changeVal()">
<option value="SemiD"><b>Semi-D</b></option>
<option value="Bungalow"><b>Bungalow</b></option>
</select>
Below is the price avaialble for Semi Detached property
<select name="price">
<option value="1.0"><b>1.0 - 1.5 Million</b></option>
<option value="1.5"><b>1-5 - 2.0 Million</b></option>
<option value="2.0"><b>2.0 - 2.5 Million</b></option>
</select>
Below is the price available for Bangalow
<select name="price">
<option value="2.5"><b>2.5 - 3.0 Million</b></option>
<option value="3.0"><b>3.0 - 4.0 Million</b></option>
</select>
so what i want to do is once the user has select their preferer property, the price list in the price Select Tag will be showing the price accordingly.
I have tried, but failed , my code is as below:
function changeVal()
{
if (document.formreg.property.value == "SemiD")document.formreg.property.options[0] = new Option("1.0", "1.0 - 1.5 Million", false, false);
document.formreg.property.options[1] = new Option("1.5", "2.0 - 1.5 Million", false, false);
document.formreg.property.options[2] = new Option("2.0", "2.5 - 1.5 Million", false, false);
}
else
{
document.formreg.property.options[0] = new Optionnew Option("2.5", "2.5 - 3.0 Million", false, false);
document.formreg.property.options[1] = new Option("3.0", "3.0 - 4.0 Million", false, false);
document.formreg.property.options[2] = null
}
Please advice....thanks!
I have two Select objects -> Property and Price, whereby the price will be listed in the Price Select tag base on the property type. For example:
<select name="property" onChange="changeVal()">
<option value="SemiD"><b>Semi-D</b></option>
<option value="Bungalow"><b>Bungalow</b></option>
</select>
Below is the price avaialble for Semi Detached property
<select name="price">
<option value="1.0"><b>1.0 - 1.5 Million</b></option>
<option value="1.5"><b>1-5 - 2.0 Million</b></option>
<option value="2.0"><b>2.0 - 2.5 Million</b></option>
</select>
Below is the price available for Bangalow
<select name="price">
<option value="2.5"><b>2.5 - 3.0 Million</b></option>
<option value="3.0"><b>3.0 - 4.0 Million</b></option>
</select>
so what i want to do is once the user has select their preferer property, the price list in the price Select Tag will be showing the price accordingly.
I have tried, but failed , my code is as below:
function changeVal()
{
if (document.formreg.property.value == "SemiD")document.formreg.property.options[0] = new Option("1.0", "1.0 - 1.5 Million", false, false);
document.formreg.property.options[1] = new Option("1.5", "2.0 - 1.5 Million", false, false);
document.formreg.property.options[2] = new Option("2.0", "2.5 - 1.5 Million", false, false);
}
else
{
document.formreg.property.options[0] = new Optionnew Option("2.5", "2.5 - 3.0 Million", false, false);
document.formreg.property.options[1] = new Option("3.0", "3.0 - 4.0 Million", false, false);
document.formreg.property.options[2] = null
}
Please advice....thanks!