SitePoint Sponsor

User Tag List

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

    How do i merge these two codes?

    I need for both changes to occur when 1 item is selected in dropdown.
    This code changes the textarea ...

    <body>
    <form name="WNBA">

    <textarea name="ladies" cols="35"> The WNBA selected team is: </textarea><br>

    <select name = "novelties"
    style = "background:'yellow' "
    onchange= "
    document.WNBA.ladies.value=
    'The WNBA selected team is: '+ document.WNBA.novelties.value ;
    "
    >
    <option value=""> The WNBA selected team is: </option>
    <option value = "Charlotte" >Charlotte_Sting</option>
    <option value = "Cleveland" >Cleveland_Rockers</option>
    <option value = "Connecticut" >Connecticut_Sun</option>
    </select>


    </form>

    </body>


    This code changes the picture...

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>WNBAteams</title>
    <script>
    function change_gif (val)
    {
    document.TL_name.src = document.WNBA.TeamInfo.value ;
    }
    </script>
    </head>

    <body>
    <table border="3" width="9%" height="99" bordercolor="#0000FF"
    id="TeamStuff" cellpadding=0>
    <tr >
    <td align=center width="71" >
    <img width="60" height="80" name=TL_name alt="TeamLogo"
    src="TL_Door.gif"
    </td>
    </tr>
    </table>
    <form name="WNBA">
    <textarea name="teams" cols="34"> The selected team is: </textarea><br>
    <select name="TeamInfo" size=1
    style="background:'yellow'"
    style="font-size:'28'"
    onchange="change_gif(value);">
    <option value=" "> Select a WNBA team
    <option value="TLCharlotte.gif ">Charlotte
    <option value="TLCleveland.gif ">Cleveland
    <option value="TLConnecticut.gif ">Connecticut
    </select>
    <br><br>
    </form>
    </body>

    </html>

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Bd2bowl,

    here is the code i have changed. I have made few things in addition. see it .

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>
    <META NAME="Generator" CONTENT="EditPlus">
    <META NAME="Author" CONTENT="Vikrant Korde">
    <META NAME="Keywords" CONTENT="">
    <META NAME="Description" CONTENT="">
    <script>
    function change_gif (val)
    {
    document.TL_name.src = document.WNBA.novelties.value ;
    alert(document.WNBA.novelties.selectedIndex);
    document.WNBA.ladies.value= 'The WNBA selected team is: '+ document.WNBA.novelties.options[document.WNBA.novelties.selectedIndex].text ;
    }
    </script>

    </HEAD>

    <body>
    <form name="WNBA">

    <img width="60" height="80" name=TL_name alt="TeamLogo"
    src="TL_Door.gif">
    <br/>
    <textarea name="ladies" cols="35"> The WNBA selected team is: </textarea><br>

    <select name = "novelties"
    style = "background:'yellow' "
    onchange= "change_gif(value)"
    >
    <option value=""> The WNBA selected team is: </option>
    <option value="TLCharlotte.gif ">Charlotte</option>
    <option value="TLCleveland.gif ">Cleveland</option>
    <option value="TLConnecticut.gif ">Connecticut</option>
    </select>
    </select>


    </form>

    </body></HTML>


    Let me know if there is something is not understanding.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fantastic, Thank you. The initial image is not posting but I will play with that part.
    How do I Repute you?

    I have another question: this is 2/3 of what I need to do.

    The final piece would be to get another image to change also but with different list of pictures.

    For ex:
    TL_Door --> TLCharlotte.gif
    TLCleveland.gif
    TLConnecticut.gif
    Need also:
    TL_Mascot --> TMCharlotte.gif
    TMCleveland.gif
    TMConnecticut.gif

  4. #4
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi bd2bowl,

    what i'll suggest you is to create an array of these images. say 2 or 3 or ... different arrays and the value of the option can be index of an array.

    on select (rather onChange) event pick the values from these arrays from the selectedIndex value of the combo box. thus u have what u want.

    About reputation u can click on an icon looks like a weighing macine in the left side for the reputation.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    [QUOTE=bd2bowl]Fantastic, Thank you.
    Your assistance was invaluable.
    This is my first use of a forum. And you have made it a pleasant experience.

  6. #6
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    29
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Closed.


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
  •