Results 1 to 3 of 3

Thread: need help with my small code

  1. #1
    Join Date
    Jan 2007
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default need help with my small code

    Hi, i'm trying to write code in php with javascripts, to see the sample please see sample from ask.com where you see image background with search text field form on the forground behind image.

    I have developed that when loading is showing first style backgroundimage, then person select image from the menu it will change style background image, the problme is that every time select image from the menu it will show on different page with different url address.

    I want to show in same page using (div) on the line where it said "<img name="previewpic" src="background/City/Snow-city2.png" width=150 height=113 border=1>' how can i write code in with div to show in same page when person select images from the menu.

    please see code:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    
    
    function previewPic(sel) {
    document.previewpic.src = "" + sel.options[sel.selectedIndex].value;
    }
    function showPic(sel) {
    images = new Array();
    images[1] = "background/City/Nice-City-1.png";
    images[2] = "background/City/Nice-City-3.png";
    images[3] = "background/City/Snow-city.png";
    images[4] = "background/City/Snow-city2.png";
    images[5] = "background/City/Snow-city3.png";
    images[6] = "background/City/Snow-city2.png";
    window.location.href = images[sel.selectedIndex+1];
    }
    
    </script>
    </HEAD>
    
    <!-- STEP TWO: Copy this code into the BODY of your HTML document  -->
    
    <BODY>
    
    <center>
    <form name=picform>
    <select name=selbox size=1 onChange="previewPic(this)">
    <option value="background/City/Nice-City-1.png">Axe
    <option value="background/City/Nice-City-3.png">Castle
    <option value="background/City/Snow-city.png">Iceberg
    <option value="background/City/Snow-city2.png">Ocean
    <option value="background/City/Snow-city3.png">Olympus
    <option value="background/City/Snow-city2.png">Temple
    </select>
    <p>
    <img name="previewpic" src="background/City/Snow-city2.png" width=150 height=113 border=1>
    <p>
    <input type=button value="Show Image" onclick="showPic(this.form.selbox)">
    </form>
    </center>
    </p>
    </p>
    </body>
    </html>
    please help thansk.

    AM

  2. #2
    Join Date
    Apr 2009
    Location
    The Land Downunder
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Just a quick question...
    What is this for?

  3. #3
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    By looking at the code it selects pictures.
    Jeremy | jfein.net

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
  •