我怀疑你需要使用javascript来做到这一点,我有三个选择
<select id="Sides">
<option value="Single">Single</option>
<option value="Double">Double</option>
</select>
<select id="Delivery">
<option value="Standard">Standard</option>
<option value="Express">Express</option>
</select>
<select id="SidesDelivery">
<option value="SingleStandard">Single Standard</option>
<option value="SingleExpress">Single Express</option>
<option value="DoubleStandard">Single Standard</option>
<option value="DoubleExpress">Single Express</option>
</select>
我想知道如何选择单面和标准交付如何在SidesDelivery中自动选择SingleStandard
我认为它可以像这样工作
OnChange if Sides select== Single && Delivery select== Single
then sidesdelivery= SingleStandard
答案 0 :(得分:2)
尝试这样的事情:
var a = document.getElementById('Sides').value;
var b = document.getElementById('Delivery').value;
document.getElementById('SidesDelivery').value = a+b ;
答案 1 :(得分:1)
试试这个解决方案,
$('#Sides,#Delivery').change(function(){
var one,two;
if(this.id=="Sides"){
one = $('#'+this.id).val();
two= $('#Delivery').val();
}
if(this.id=="Delivery"){
two = $('#'+this.id).val();
one= $('#Sides').val();
}
$('#SidesDelivery > option').each(function(index,obj){
if($(obj).text().split(" ")[0]== one && $(obj).text().split(" ")[1]==two){
$(this).prop('selected','selected');
}
});
});
<强> DEMO 强>