Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

hours of surfing and no answer...multiple values one dropdown selection?

anyone have a php/java script where you choose one option on a dropdown list and it returns two separate values??? I need it to preview both an image (which I got working) and a text value. My eyes are dry...

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    <select id="elmnt1">

    <option value="1">value1</option>

    <option value="2">value2</option>

    </select>

    <div id="elmnt2"></div>

    <script>

    function showValues()

    {

    if (document.getElementById('elmnt1').value == '1') {

    image = '<img src="image1.jpg">';

    text = 'this is image1!';

    } else if (document.getElementById('elmnt1').value == '2') {

    image = '<img src="image2.jpg">';

    text = 'this is image2!';

    }

    document.getElementById('elmnt2').innerHTML = image+'<br>'+text;

    </script>

Still have questions? Get your answers by asking now.