1
我正在使用下面的腳本,需要在前兩個基礎上更改3個下拉列表的值,目前它顯示相同的值以改變第一個下拉列表中的值。這裏是腳本---通過javascript更改3個下拉值
<script type="text/javascript">
function changeprice(id){
var value = id;
if(value == ""){
document.getElementById('price').value="";
alert("Please select one valid word count");
return false;
}
if(value == "Lessthan1000"){
var newprice = "USD 290";
}
if(value == "Lessthan2000"){
var newprice = "USD 540";
}
if(value == "Lessthan4000"){
var newprice = "USD 1050";
}
if(value == "Lessthan6000"){
var newprice = "USD 1900";
}
var eprice = newprice;
document.getElementById('price').value = eprice;
}
</script>
<select name="sp" id="sp" class="servicecategory">
<option value="" selected>Please Select...</option>
<option value="Medical and Biomedical Manuscript Writing" <?php if($servicename == "Medical and Biomedical Manuscript Writing"){ echo(" selected=\"selected\""); } ?>>Medical and Biomedical Manuscript Writing</option>
<option value="Medical and Biomedical Manuscript Rewriting" <?php if($servicename == "Medical and Biomedical Manuscript Rewriting"){ echo(" selected=\"selected\""); } ?>>Medical and Biomedical Manuscript Rewriting</option>
</select>
<select name="Word_Count" id="Word_Count" onChange="changeprice(this.value)">
<option value="" selected>Please Select...</option>
<option value="Lessthan1000">1 - 1000 words</option>
<option value="Lessthan2000">1001 - 2000 words</option>
<option value="Lessthan4000">2001 - 4000 words</option>
<option value="Lessthan6000">4001 - 6000 words</option>
</select>
<tr>
<td valign="top" align="right">Price:</td>
<td width="5"></td>
<td valign="top" align="left"><input type="text" name="price" id="price" value="" readonly="" size="20"><br /></td>
</tr>
需要改變的價值一旦我選擇醫療和生物醫學手稿重寫在第一個下拉列表中。任何建議現在要做什麼?爲醫學和生物醫學手稿其做工精細writing--三江源
它不工作,不改變它們的值和它們的價格。:( – user1859847
這隻會改變第二個選擇元素的選擇選項。如果你w螞蟻它改變輸入(價格),然後我會添加'changeprice(sel.options [0] .value);'在函數的末尾。我將修改代碼。 –
此外,您需要擴展「changeprice」函數以包含新選項值 –