开发者

HTML jquery vs. doing it manually

开发者 https://www.devze.com 2023-01-28 06:02 出处:网络
i need to load images as the user selects. i am hoping to load them using DIV, but how to do it? jqu开发者_StackOverflowery can do it and it is in javascript, i believe.

i need to load images as the user selects.

i am hoping to load them using DIV, but how to do it?

jqu开发者_StackOverflowery can do it and it is in javascript, i believe.

so how can i write a function that manages div completion or is it too complicated?

just looking for clarity at this stage.

thanks.

edit: well i have drop down listing and as user selects one option i need to load a bunch of images. i would like to cache the images and then show them.

i can show you my site but that would be advertising.

  <select id="videodromeMenu" onchange="doDestination('videodromeMenu');">
                <option>Choose Your Destination...</option>
                <option>Pawns In The Game</option>
                <option>Akira</option>
                <option>Apocalypse Now</option>
                <option>Blade Runner</option>
                <option>Crouching Tiger Hidden Dragon</option>
                <option>Dr. Strangelove</option>
                <option>Enemy at the Gates</option>
                <option>Nikita</option>
                <option>Out Of Africa</option>
                <option>Pulp Fiction</option>
                <option>Scarface</option>
                <option>Silence Of The Lambs</option>>
                <option>The Abyss</option>
                <option>The Big Blue</option>
                <option>The Thirteenth Floor</option>
       </select>

here is some code but wont really help i think.


<select id="imageList">
    <option value="purple.jpg">Purple.jpg</option>
    <option value="red.jpg">Red.jpg</option>
    <option value="blue.jpg">Blue.jpg</option>
</select>

<div id="imageDisplay"></div>

<script type="text/javascript">
    $( '#imageList' ).change( function() {
        $( '#imageDisplay' ).empty() // remove what's currently in the div
        $( '#imageDisplay' ).html( '<img src="' + $( this ).val() + '" />' );
    });
</script>

This will obviously need tweaking... especially the paths to the images. but it's basically what I -think- you're looking for.

0

精彩评论

暂无评论...
验证码 换一张
取 消