转移价值从下拉到

时间:2014-08-26 16:52:12

标签: if-statement asp-classic

我需要一些帮助...

我需要位置下拉框来确定应将表单发送到的相应收件箱。

如果我从下拉框中选择休斯顿,它会将其发送到PayrollUSA电子邮件。

我目前正在使用单选按钮进行选择,但我希望通过下拉菜单自动执行。

我是新手,但我确定这是一个可以将它们联系在一起的if语句......

我正在使用.asp。

                <input type="radio" name="payroll" value="PayrollUSA@mail.com" checked="checked">US Payroll
                <input type="radio" name="payroll" value="PayrollCAN@mail.com">CAN Payroll  
                <input type="radio" name="payroll" value="PayrollUK@mail.com">UK Payroll
                <input type="radio" name="payroll" value="PayrollHK@mail.com">HK Payroll  

下拉选择

           <SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
              <option selected >Select</option>
                <OPTION>Calgary</OPTION>
                <OPTION>Chicago</OPTION>
                <OPTION>Hong Kong</OPTION>
                <OPTION>Houston</OPTION>
                <OPTION>London</OPTION>
                <OPTION>Los Angeles</OPTION>
                <OPTION>Montreal</OPTION>
                <OPTION>New York</OPTION>
                <OPTION>New York Corporate</OPTION>
                <OPTION>Philadelphia</OPTION>
                <OPTION>San Francisco</OPTION>
                <OPTION>Toronto</OPTION>
                <OPTION>Toronto Corporate</OPTION>
                <OPTION>Vancouver</OPTION>
             </SELECT>

2 个答案:

答案 0 :(得分:2)

如果您需要保留选项值,请尝试以下操作:

<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
    <option value="">Select an Option</option>
    <option <% if Business_Unit= "PayrollCAN@mail.com" then %> selected <% End if %> value="PayrollCAN@mail.com">Calgary</option>
    <option <% if Business_Unit= "PayrollUSA@mail.com" then %> selected <% End if %> value="PayrollUSA@mail.com">Chicago</option>                       
</select>

等。对于每个选项,相同的值可用于不同的选项显示

答案 1 :(得分:-1)

我成像这应该只是基于HTML。因此,您的选项菜单应如下所示:

<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
          <option value="-1">Select an Option</option>
            <OPTION value="PayrollCAN@mail.com">Calgary</OPTION>
            <OPTION value="PayrollUSA@mail.com">Chicago</OPTION>
            <OPTION value="PayrollHK@mail.com">Hong Kong</OPTION>
            <OPTION value="PayrollUSA@mail.com">Houston</OPTION>
            <OPTION value="PayrollUK@mail.com">London</OPTION>
            <OPTION value="PayrollUSA@mail.com">Los Angeles</OPTION>
            <OPTION value="PayrollCAN@mail.com">Montreal</OPTION>
            <OPTION value="PayrollUSA@mail.com">New York</OPTION>
            <OPTION value="PayrollUSA@mail.com">New York Corporate</OPTION>
            <OPTION value="PayrollUSA@mail.com">Philadelphia</OPTION>
            <OPTION value="PayrollUSA@mail.com">San Francisco</OPTION>
            <OPTION value="PayrollCAN@mail.com">Toronto</OPTION>
            <OPTION value="PayrollCAN@mail.com">Toronto Corporate</OPTION>
            <OPTION value="PayrollCAN@mail.com">Vancouver</OPTION>
         </SELECT>

如果需要,您可以多次使用相同的值