SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question textarea and drop down in form

    I need 1 change to trigger all three actions. I can only get one to change at a time.

    onchange=
    1)change gif file1 in table based on selection in drop down
    2)change gif file2 in table based on selection in drop down
    3)change text in textarea based on selection in drop down


    <head>
    <script>
    function change_gif ()
    {
    document.TL_name.src = document.WNBA.TeamInfo.value ;

    }
    </script>
    </head>

    <body>

    <table>
    <tr>
    <td>
    <img name=TL_name alt="TeamLogo" src="TL_Door.gif"
    </td>
    </tr>
    <tr>
    <td>
    <img name=TM_name alt="TeamMascot" src="TM_Door.gif"
    </td>
    </tr>
    </table>

    <form name="WNBA">
    <textarea name="teams"> The selected team is: </textarea><br>
    <select name="TeamInfo" size=1
    onchange="change_gif();
    document.WNBA.teams.value = document.WNBA.TeamInfo.value;">
    <option value=""> Select a WNBA team
    <option value="CharlotteLogo.gif">Charlotte
    <option value="ClevelandLogo.gif">Cleveland
    <option value="ConnecticutLogo.gif">Connecticut
    </select>
    <br><br>
    </form>

    </body>

    ------
    don't know how to implement this
    <option value="CharlotteMascot.gif">Charlotte
    <option value="ClevelandMascot.gif">Cleveland
    <option value="ConnecticutMascot.gif">Connecticut

    Please help.. Brenda
    Last edited by bd2bowl; Feb 20, 2005 at 23:53. Reason: delete

  2. #2
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this


    <script>
    function change_gif ()
    {
    nIndx = window.document.WNBA.TeamInfo.selectedIndex;
    nVal = eval("window.document.WNBA.TeamInfo.options[" + nIndx + "].value");
    if (nVal != "" )
    {
    document.TL_name.src = nVal ;
    document.TM_name.src = nVal ;
    document.WNBA.teams.value = nVal;
    }
    }
    </script>


    <body>
    <table>
    <tr>
    <td>
    <img name=TL_name alt="TeamLogo" src="TL_Door.gif" >
    </td>
    </tr>
    <tr>
    <td>
    <img name=TM_name alt="TeamMascot" src="TM_Door.gif">
    </td>
    </tr>
    </table>

    <form name="WNBA">
    <textarea name="teams"> The selected team is: </textarea><br>
    <select name="TeamInfo" size=1 onchange="change_gif();">
    <option value=""> Select a WNBA team </option>
    <option value="CharlotteLogo.gif">Charlotte</option>
    <option value="ClevelandLogo.gif">Cleveland</option>
    <option value="ConnecticutLogo.gif">Connecticut</option>
    </select>
    <br><br>
    </form>
    </body>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •