Results 1 to 5 of 5

Thread: iFrames

  1. #1
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iFrames

    Is it possible to:

    1. Make an iFrame only show a certain part of an external webpage?
    2. Make the iFrame scroll to a certain pixel distance on that external webpage when your webpage is loaded?


    I am told that there are certain ways to do option 2, but no-one has given me codes for that yet.

    I assume it would be a simple add-on to a tag, for example:

    Code:
    <iFrame src="http://www.target.com/" width="100" height="100" scrollTo="183,32">
    The red part is something I made up and have tried (it doesn't work unfortunately ), but hopefully you guys will know something that does work. Thanks for your time.

  2. #2
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    scrollTo isn't a valid iFrame property, but it probably is possible to do this with JavaScript. Try googling your query
    - Mike

  3. #3
    Join Date
    Jan 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mburt
    scrollTo isn't a valid iFrame property
    Yes, I do know this. Haven't you read what it says below the code?

  4. #4
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    The onscroll property doesn't work for the iframe tag either. I can't see how it's possible, unless you change the page you are displaying.
    - Mike

  5. #5
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    This is how it would work with a DIV:

    Code:
    <html>
    <head>
    <script type="text/javascript">
    function test() {
    var frame = document.getElementById("test")
    window.status = frame.scrollTop
    if (frame.scrollTop > 183) {
    	frame.scrollTop = 183
    	return false;
    	}
    }
    </script>
    </head>
    <body>
    <div style="height:200px;width:500px;overflow-y:scroll" id="test" onscroll="test()">
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    <br>test
    </div>
    </body>
    </html>
    - Mike

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
  •