选择下拉字段选项,显示文本输出

时间:2017-06-05 17:18:11

标签: html hubspot

我列出了各州的供应商的州和地址。我希望在选择状态时显示输出地址。我已经尝试过在Stackoverflow上找到的脚本,但无法让它们工作。我想出的代码如下。我无法弄清楚如何进行选择以创建地址输出。

<p><strong>Our Law Firms</strong></p>
<p>LegalShield has a network of dedicated law firms in 50&nbsp;states and 4 Canadian provinces made up of seasoned lawyers with an average of 22&nbsp;years experience. Our provider law firms provide legal protection to over a million members any time they need it, even in covered emergency situations, 24/7, 365 days a year.</p>
<p><label for="stateselect">Select Your Your State </label></p>
<select id="Provider">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jaersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
<p>
  
  
<script>// <![CDATA[
var Provider = document.getElementById("Provider"),
          Provideraddress = document.getElementById("phoneNumber"),
          stores = {
            noSelection: "",
            Lowestoft: "12345678",
            GtYarmouth: "222 444 666",
            Norwich: "999 999 999",
            Diss: "0000000000000"
          }
          
      nearestStore.onchange = function(){
        Address.innerHTML = stores[this.value];
      }
// ]]></script>
</p>

0 个答案:

没有答案