Images swapping


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Images swapping

  1. #1
    pierre casimir Guest

    Images swapping


    How to create a page to do do this?
    Write a page with three images on it, each of them a navigational icon
    leading to another Web site. Each time the user mouses over a navigational

    icon, it should do an image swap, and a new window should open with an
    appropriate URL. For example, the three images could be of an apple,
    a book, and a sun, the image could swap to a happy sun, and a window with
    the Sun Microsystems homepage could open up. Create this effect using a

    function that takes three parameters: the image to swap, the new image
    to put in its place, and the URL to open in the new window.


  2. #2
    Frederiek Guest

    Re: Images swapping


    Create a function for the image swaps (only one parameter is needed when using
    an imageconstructor and a name attribute in the img tag) and add a line for
    the window.open (that uses the second parameter in the function), eg:

    <html>
    <head>
    <script type="text/javascript">
    <!--
    //image constructor
    mmOff = new Image();
    mmOff.src = "mmOff.gif";
    mmOn = new Image();
    mmOn.src = "mmOn.gif";

    function imgOn(imgName, url) {
    if (document.images) document [imgName].src = eval(imgName + "On.src"); //
    the swap
    mywin = window.open(url,'popwin','toolbars=no,width=100,height=100,top=0,left=0');
    //opening a popup
    mywin.focus(); //set focus to the popup if it's already open
    }
    //-->
    </script>
    </head>
    <body>
    <a href="#" onmouseover="imgOn('mm', 'next.html')"><img src="mmOff.gif" width="90"
    height="16" border="0" alt="alternative text" name="mm"></a>
    </body>
    </html>

    cya
    Frederiek


    "pierre casimir" <pcasimir@nova.edu> wrote:
    >
    >How to create a page to do do this?
    >Write a page with three images on it, each of them a navigational icon
    >leading to another Web site. Each time the user mouses over a navigational
    >
    >icon, it should do an image swap, and a new window should open with an
    >appropriate URL. For example, the three images could be of an apple,
    >a book, and a sun, the image could swap to a happy sun, and a window with
    > the Sun Microsystems homepage could open up. Create this effect using

    a
    >
    >function that takes three parameters: the image to swap, the new image


    >to put in its place, and the URL to open in the new window.
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center