Results 1 to 2 of 2

Thread: Where to start?

  1. #1
    Join Date
    Jun 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Where to start?

    I want to make a webpage where there is an image in the center that changes depending on what button the mouse is hovering over. Once clicked to go to another page. I think I can do it in flash, but is there a better way? Especially if I want to make a liquid type page. Thanks.

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Of course:
    Code:
      <script type="text/javascript">
        function changeImage() {
          var data = this.rel.split("|"),
            img = document.images[changeImage.img];
          img.src = data[1];
          img.alt = data[2];
        }
        changeImage.img = "centreimage";
        function unChangeImage() {
          var img = document.images[changeImage.img];
          img.src = changeImage.defaultSrc;
          img.alt = changeImage.defaultAlt;
        }
    
        onload = function() {
          changeImage.defaultSrc = img.src;
          changeImage.defaultAlt = img.alt;
          for(var i = 0, a = document.links; i < a.length; ++i) {
            if(a[i].rel && a[i].rel.indexOf("swap|") === 0) {
              a[i].onmouseover = changeImage;
              a[i].onmouseout = unChangeImage;
            }
          }
        };
      </script>
    </head>
    <body>
      <ul>
        <a href="page1.html" rel="swap|redleaves.png|Red leaves swirling in an autumnal wind">Page One</a>
        <a href="page2.html" rel="swap|images/greenleaves.jpg|First green leaves of spring">Page One</a>
      </ul>
      <p>
        <img src="default.png" alt="Some text describing the default image">
      </p>
    Ugh, I've been forced (practically at gunpoint) to use VB6 for a project recently, and it's messed up my coding style terribly.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •