Jquery 根据选择的2个不同下拉菜单选项更改值输入

Jquery 根据选择的2个不同下拉菜单选项更改值输入,jquery,html,forms,Jquery,Html,Forms,我需要做到以下几点: 我有两个下拉菜单的形式为手机维修店网站。 一个下拉菜单称为“电话型号”,另一个下拉菜单称为“故障类型” 我需要拿出一个价格后,我结合这两个选择。 它不一定必须基于选择的实际值: 它基本上是这样的: if Phone model = "iPhone 6", failure type = "cracked screen" print the value 200 somewhere. OR Phone model = "iPhone 4" failure type = "

我需要做到以下几点:

我有两个下拉菜单的形式为手机维修店网站。 一个下拉菜单称为“电话型号”,另一个下拉菜单称为“故障类型”

我需要拿出一个价格后,我结合这两个选择。 它不一定必须基于选择的实际值: 它基本上是这样的:

if 
Phone model = "iPhone 6",
failure type = "cracked screen"
print the value 200 somewhere.

OR 

Phone model = "iPhone 4"
failure type = "cracked screen"
print the value 50 somewhere. 
我需要做的示例:


我怎样才能做到这一点呢?

试试这样的方法:

if 
Phone model = "iPhone 6",
failure type = "cracked screen"
print the value 200 somewhere.

OR 

Phone model = "iPhone 4"
failure type = "cracked screen"
print the value 50 somewhere. 
获取第一个和第二个下拉值,然后检查这两个值,如:

if(val != '' && val2 != ''){
    if(val1 = 'text1' && val2 == 'text2'){
        document.getElementById('amount') = '50';   // will put the amount to textbox
    }
}

试试这样的东西:

if 
Phone model = "iPhone 6",
failure type = "cracked screen"
print the value 200 somewhere.

OR 

Phone model = "iPhone 4"
failure type = "cracked screen"
print the value 50 somewhere. 
获取第一个和第二个下拉值,然后检查这两个值,如:

if(val != '' && val2 != ''){
    if(val1 = 'text1' && val2 == 'text2'){
        document.getElementById('amount') = '50';   // will put the amount to textbox
    }
}

你可以这样做

示例在jquery中,但您可以通过原始javascript执行相同的操作

HTML

请参见示例:


如果你喜欢这个,它会更干净,所以你可以有很多这样的组合

JS

请参见示例:


希望这有帮助!:)

你可以这样做

示例在jquery中,但您可以通过原始javascript执行相同的操作

HTML

请参见示例:


如果你喜欢这个,它会更干净,所以你可以有很多这样的组合

JS

请参见示例:



希望这有帮助!:)

嗨!我现在就试试,让你知道它是怎么回事!所以我做了这个,但它没有起作用,我想知道我是否必须指定我在某处谈论的是哪种形式,或者可能我不理解脚本?如果(problem!=''&&smartphonemodel!=''){如果(problem='No-carga'&&smartphonemodel='Core'){document.getElementById('price')='50';}}}实时页面是www.phone-fix.com.arso,你认为呢?太乱了吗?嗨!我现在就试试,让你知道它是怎么回事!所以我做了这个,但它没有起作用,我想知道我是否必须指定我在某处谈论的是哪种形式,或者可能我不理解脚本?如果(problem!=''&&smartphonemodel!=''){如果(problem='No-carga'&&smartphonemodel='Core'){document.getElementById('price')='50';}}}实时页面是www.phone-fix.com.arso,你认为呢?太乱了吗?是的,有可能。我怎么能这样做呢!你问这是否可能!欢迎来到堆栈溢出!我尽我所能地编辑了你的问题。但是,首先请自己尝试一下,如果遇到问题,请来到这里并添加代码和描述,以便更多了解该主题的人能够看到它。请在遇到的特定错误消息中进行编辑,以防识别特定问题。祝你好运欢迎来到堆栈溢出!请看下面我的答案,希望能涵盖您的问题。若答案能解决你们的问题,别忘了投票赞成。干杯是的,这是可能的。我该怎么做呢!你问这是否可能!欢迎来到堆栈溢出!我尽我所能地编辑了你的问题。但是,首先请自己尝试一下,如果遇到问题,请来到这里并添加代码和描述,以便更多了解该主题的人能够看到它。请在遇到的特定错误消息中进行编辑,以防识别特定问题。祝你好运欢迎来到堆栈溢出!请看下面我的答案,希望能涵盖您的问题。若答案能解决你们的问题,别忘了投票赞成。干杯