问题描述:

I have an HTML form with a dropdown list of addresses. My client needs the selected address to appear large at the bottom of the form data so that the recipient can print the email containing the form data and cut the large address off the bottom of the sheet to be used as a shipping label.

网友答案:

Inline scripts is not the best and most flexible practice. I would go with a solution more like this. http://jsbin.com/mewunu/1/edit?html,js,output

When the menu option is selected, you need to place the value of that selected option in your shipping label area.

网友答案:

This is my form code right now:

  • First Name
  • Last Name
  • Company Name
  • EnerCare Solutions
  • Shipping Address
  • ... 80 Allstate Parkway, Markham, ON, L3R 6H3 30 High Meadow, Toronto, ON, M6L 2Z5 4000 Victoria Park Avenue, Toronto, ON M2H 3P4
  • Mens Size Womens Size
  • ... Small Medium Large XL XXL 3X 4X 5X ... X-Small Small Medium Large XL 2X 3X
    Color Black Qty 1

    This is what my recipient's email looks like:
    email: realname: First_Name: TEST Last_Name: TEST Company_Name: Enercare Solutions Shipping_Address: 4000 Victoria Park Avenue, Toronto, ON M2H 3P4 Mens_Size: ... Womens_Size: 2X Color: Black Qty: 1 Submit: Submit

    I NEED THE SELECTED SHIPPING ADDRESS TO APPEAR HERE in 36pt TEXT

    网友答案:

    Are you looking for something like this?

    <select id="select" onchange='document.getElementById("large").innerHTML = document.getElementById("select").value'>
        <option>Select address...</option>
        <option>Address 1</option>
        <option>Address 2</option>
    </select>
    <h2 id="large"></h2>
    

    https://jsfiddle.net/6x0mv9qe/

    Just check if the select is changed and add it's value to the element you want.

    相关阅读:
    Top