Four Views of Image In One Image

[Total: 0    Average: 0/5]

This example shows how to have an image changed with simple href clicks.

Head Code:

 <script language="Javascript"> 
    <!--Begin 
    var front = new Image(35,35); front.src = "http://www.js-examples.com/js/pic1.gif"; 
    var back  = new Image(35,35); back.src  = "http://www.js-examples.com/js/pic2.gif";
    var top   = new Image(35,35); top.src   = "http://www.js-examples.com/js/pic3.gif"; 

    function doButtons(picimage) { 
    document.images[0].src = picimage;
    } 

    //End--> 
</script>

Body Code:


    <center><table><tr> 
    <td><p> 
    <li><a href = "javascript:doButtons(front.src)">front view<p> 
    <li><a href = "javascript:doButtons(back.src)">back view<p> 
    <li><a href = "javascript:doButtons(top.src)">top view<p> 
    </center></td> 
    <td><p align="center"> 
    <img name=mypic border="1" src="http://www.js-examples.com/js/pic4.gif" width="35" height="35"></p> 
    </td></tr> 
    </table> 

Times Viewed: 1

Leave a Reply

Your email address will not be published. Required fields are marked *