www.webdeveloper.com
Results 1 to 4 of 4

Thread: Displaying an image based on dropdown selection

  1. #1
    Join Date
    Nov 2004
    Posts
    8

    Displaying an image based on dropdown selection

    I have no idea what forum to put this in. My app is an ASP.NET application. But I'm having problems with populating a image based on a javascript that creates a dropdown list which is a collection of images, and there is some code behind VB for the aspx page that checks to see what the user selects from the dropdown list.

    I have all the funtionality working, except I need to show a gif image based on the selection from the dropdown list. The names in the selection are the same as the names of the images (minus the .gif) The real problem comes in because I use VB code behind in the aspx page to check and see what object was selected from the dropdown list.

    Could someone please help me with this? Below is the javascript which creates the dropdown, along with the html image source.

    function getSymbols()
    {
    var map = getMainMap();
    var theSymColl = map.getSymbols();
    var opt = new Option("-- Select a symbol --", "null");
    eval("document.draw_form.draw_symbol_name.options[0]=opt");
    for (var i=0; i < theSymColl.size(); i++){
    var opt = new Option(theSymColl.item(i), theSymColl.item(i));
    eval("document.draw_form.draw_symbol_name.options[i+1]=opt");

    }

    }


    <IMG height="25" alt="" src="images/"+draw_symbol_name+".gif" width="30" border="0">

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    why are you using javascript to begin with? It seems unnecessary. You could just do this all server side.

  3. #3
    Join Date
    Nov 2004
    Posts
    8
    I'm very new, and to be honest I have no idea how to convert that javascript to .net, but yes that would be much better if I could.

  4. #4
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,222
    why do you need to convirt anything? Why not just write it all in vb.net. Java script and a server side language are two very different animals. Java script is fully event oriented for instance and asp.net is now quasi event oriented, but this makes a big difference.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles