Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2006
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer dropdown linked to image thumbs

    How would this work:

    A dynamically generated dropdown box that will display something like

    A
    B
    C

    Next to it I need to display image thumbnail.
    I would think the easiest way would be to name jpegs A.jpg B.jpg C.jpg
    When A is selected, it would go and pick up a corresponding image and display it.
    Ajax and JavaScript come to mind, is there a way to entertwine it all into ASP?

    Entire solution would be really nice, if you've got time for this.
    Thank you.
    I know that I know nothing

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    How about this:

    you name your images as you said
    you keep them all in a specified folder

    you populate your dropdown by getting a list of files in that folder
    you get your asp to write the drowndown options HTML, and also a javascript image preload array

    when the dropdown box changes, you use client-side javascript to change the image, and don't have to make trips to the server every time.

  • #3
    Registered User
    Join Date
    Jan 2006
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Straight ASP, no...

    Like Spudhead said, you'll need the javascript to display your image if you don't want to submit the page.

  • #4
    New Coder
    Join Date
    Aug 2006
    Posts
    72
    Thanks
    0
    Thanked 0 Times in 0 Posts
    hum, yeah. except I don't know javascript.
    Was hoping for a snippet.
    I know that I know nothing

  • #5
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    u got lucky, i had a script that i made a while back laying around.

    PHP Code:
    <script>
    function 
    DisplayImage(myForm){
        var 
    strImageName myForm.SelectImage;
        
    document.getElementById("DisplayThumb").innerHTML "<img src='images/" strImageName.value "' />"
    }
    </script>

    <form>
    <select name='SelectImage' id='SelectImage' onchange='DisplayImage(this.form)'>
    <option value='checkmark.jpg'>1</option>
    <option value='help2.gif'>2</option>
    <option value='help_test.gif'>3</option>
    <option value='icon_email.gif'>4</option>
    <option value='login_button.gif'>5</option>
    </select>
    </form>

    <div name='DisplayThumb' id='DisplayThumb'></div> 


  •  

    Posting Permissions

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