Javascript 选择时更改功能
继续从,只需要显示Javascript 选择时更改功能,javascript,Javascript,继续从,只需要显示 function changeprice1(id){ 选择第二个下拉列表,即医学和生物医学手稿重写。现在该怎么办,我现在想不起来了。jS有什么帮助吗 这是第一个下拉列表 <select name="sp" id="sp" class="servicecategory"> <option value="" selected>Please Select...</option> <option value="Medical and Bio
function changeprice1(id){
选择第二个下拉列表,即医学和生物医学手稿重写。现在该怎么办,我现在想不起来了。jS有什么帮助吗
这是第一个下拉列表
<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="sp" id="sp" class="servicecategory" 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>
试试这个
<script type="text/javascript">
function changeprice(id)
{
var value = id;
selectedmenu=document.getElementById("sp").value
if(selectedmenu == "select"){
alert("Please select one valid word count");
fnc();
return false;
}
if(selectedmenu=='Medical and Biomedical Manuscript Writing')
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;
if(selectedmenu=='Medical and Biomedical Manuscript Rewriting')
{
if(value == "Lessthan1000"){
var newprice = "USD 390";
}
if(value == "Lessthan2000"){
var newprice = "USD 690";
}
if(value == "Lessthan4000"){
var newprice = "USD 1600";
}
if(value == "Lessthan6000"){
var newprice = "USD 2900";
}
var eprice = newprice;
document.getElementById('price').value = eprice;
}
}
function fnc()
{
document.getElementById("select").selected=true;
}
</script>
<select name="sp" id="sp" class="servicecategory" onchange="fnc()">
<option value="select" selected>Please Select...</option>
<option value="Medical and Biomedical Manuscript Writing" >Medical and Biomedical Manuscript Writing</option>
<option value="Medical and Biomedical Manuscript Rewriting" >Medical and Biomedical Manuscript Rewriting</option>
</select>
<select name="Word_Count" id="Word_Count" onChange="changeprice(this.value)">
<option value="select" id="select">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>
你能把脚本和html代码部分放进去吗?好的,我已经看过了。你能告诉我你的第一个名为“sp”的下拉列表到底想做什么吗。我不清楚你到底想做什么,因为你的第二个下拉列表工作得很好是的,我有两个服务,一个是医学和生物医学手稿重写,第二个是医学和生物医学手稿写作,对,在这方面,我们有两个服务包。一旦用户选择2个Drodpown,我们需要显示每个服务的价格,因为软件包会更改为1-1000字等等。。得到了吗?请发布你的HTML。如果你有一个链接到这个页面,这样我就可以看到整个代码,那就太好了。这将真正有助于某人为您提供解决方案。如果任何浏览器中禁用javascript。。。价格不会在选择任何服务或字数时显示,因此,如果禁用javascript,价格及其在WORK DETAILS下的文本框应如何隐藏在表单中。有什么帮助吗?
<script type="text/javascript">
function changeprice(id)
{
var value = id;
selectedmenu=document.getElementById("sp").value
if(selectedmenu == "select"){
alert("Please select one valid word count");
fnc();
return false;
}
if(selectedmenu=='Medical and Biomedical Manuscript Writing')
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;
if(selectedmenu=='Medical and Biomedical Manuscript Rewriting')
{
if(value == "Lessthan1000"){
var newprice = "USD 390";
}
if(value == "Lessthan2000"){
var newprice = "USD 690";
}
if(value == "Lessthan4000"){
var newprice = "USD 1600";
}
if(value == "Lessthan6000"){
var newprice = "USD 2900";
}
var eprice = newprice;
document.getElementById('price').value = eprice;
}
}
function fnc()
{
document.getElementById("select").selected=true;
}
</script>
<select name="sp" id="sp" class="servicecategory" onchange="fnc()">
<option value="select" selected>Please Select...</option>
<option value="Medical and Biomedical Manuscript Writing" >Medical and Biomedical Manuscript Writing</option>
<option value="Medical and Biomedical Manuscript Rewriting" >Medical and Biomedical Manuscript Rewriting</option>
</select>
<select name="Word_Count" id="Word_Count" onChange="changeprice(this.value)">
<option value="select" id="select">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>