SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Remote image flips

    Hi everyone,

    I want to make an image flip with JavaScript while I hover over some navigation icons. The problem is that the target image is inside an iframe (the navigation is outside, in the main browser window). Is it possible to make the image flip anyhow?

    TIA!

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this:
    Code:
    <html>
      <head>
        <script language="javascript">
        <!--
          function flipgif(){
            window.myframe.myimg.src="cyan_down.gif";
          }
          function flipback(){
            window.myframe.myimg.src="cyan_up.gif";
          }
        //-->
        </script>
      </head>
      <body>
        <a href=# onMouseOver="flipgif()" onMouseOut="flipback()">Flip gif</a>
        <iframe id="myframe"
          src="iframecontent.html"
          scrolling="no"
          width="200" height="200"
          frameborder="1">	
        </iframe>
      </body>
    </html>
    CLICK for DEMO


    Is that what you were after?

    Andy
    From the English nation to a US location.

  3. #3
    Almeaty Member
    Join Date
    Jul 2000
    Location
    Nowhere
    Posts
    278
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up

    Exactly! Thank you so much!! :-)

  4. #4
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're welcome

    Although that does the job, I don't know if it's correct usage of the DOM. I tried using getElementById but it didn't work in this instance. At least I'm not using document.all.

    Mind you, it'll almost certainly work in any browser that supports i-frames


    Andy
    From the English nation to a US location.


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
  •