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 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Drop Down Image Selector I

    Halo Amigos!

    I succesfully executed the Drop Down Image Selector I script into my page. I have the images appearing as I want them. However, I also have three other options in my drop down menu that do not require images at all. When i give it a different value other than a path to an image, it displays a broken image placeholder on the page.

    How do I bypass this without changin the value that I need?

    Thanks!

    Adios Amigos!

    ps: [URL=http://www.hcedesigns.com/spec.html]
    Last edited by fncuis; 11-08-2004 at 09:39 PM. Reason: Forgot URL :P

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Please try the following


    <HTML>
    <HEAD>
    <TITLE>Document Title</TITLE>

    <SCRIPT language=javascript>
    <!--

    function showimage(){
    if (!document.images)
    return

    data=document.specForm.poolshape.options[document.specForm.poolshape.selectedIndex].value

    if(data.indexOf("gif")!= -1||data.indexOf("jpg")!= -1){ // if an image
    document.getElementById("display").innerHTML='<IMG height=72 src="'+data+'" width=72 name=pictures>' // show the image
    }
    else{ // if not an image
    document.getElementById("display").innerHTML=data // then write the string
    }

    }
    //-->
    </SCRIPT>


    </HEAD>
    <BODY>
    <FORM name="specForm">
    <SELECT class=txtFields onchange=showimage() name=poolshape>
    <OPTION value=null selected>--</OPTION>
    <OPTION value="Leave it to our designers">Leave it to our designers!</OPTION>
    <OPTION value="Drawn on attached 8.5x11">Drawn on attached 8.5x11</OPTION>
    <OPTION value=Lap>Lap</OPTION>
    <OPTION value=pic1.jpg>Pic1</OPTION>
    <OPTION value=?>?</OPTION>
    <OPTION value=?>?</OPTION>
    </SELECT>
    </FORM>

    <div id="display"></div>

    </BODY>
    </HTML>
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    New Coder
    Join Date
    Nov 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Nice

    But it doesnt work... actually, the code is in line, but throws up an error when you go and select pic1.

    Currently, all selections show the same image. Am i missing something that needs to be changed?

    Thanks for the speedy reply "silent one"

    -F

    http://www.hcedesigns.com/spec.html

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Did you try the code before putting it in your page?

    I forgot to tell you to change this line in your page


    <IMG height=72 src="Pool Designs,Swimming Pool Plans, Aquatic Engineering, Residential &amp; Commercial Pool-Spa Designs by Horner Consulting engineers!_files/gr004side.gif" width=72 name=pictures>


    for this line

    <div id="display"></div>
    Last edited by Mr J; 11-09-2004 at 12:06 AM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    New Coder
    Join Date
    Nov 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Mr.J,

    I cannot find that string of code anywhere in my page...

  • #6
    New Coder
    Join Date
    Nov 2004
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Aha

    Dude, my apologies, after re-reading your instructions, i got it to work.

    Thank you very much.

    -F


  •  

    Posting Permissions

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