Results 1 to 5 of 5

Thread: iframe

  1. #1
    Join Date
    Nov 2005
    Location
    ankara / turkiye
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iframe code - please help

    think that we have a code like:
    <iframe src="a.htm"></iframe>

    and the source of a.htm is:
    <img src="a.jpg" width="300" height="300"><br>
    <img src="b.jpg" width="500" height="300">


    so it should look in frame like this:
    aaaaaaaa
    aaaaaaaa
    aaaaaaaa
    aaaaaaaa

    bbbbbbbbbbbbb
    bbbbbbbbbbbbb
    bbbbbbbbbbbbb
    bbbbbbbbbbbbb


    then my problem is:
    i want to see only b.jpg in the frame. so i need a code that shows the a.htm scrolled down to 300 pixel of the original.

    (i'm not ought to delete a.jpg so i only want to display b.jpg in my page as a result)

    anyone has a script for this? or is there code for that. i've soought too much but i couldn't find any please help.
    Last edited by cadaver; 11-22-2005 at 09:54 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    On a.htm use this as an onload event in the body tag (highlight red):

    Code:
    <body onload="window.scrollTo(0,300);">
    If there isn't enough room at the bottom of the page, you may have to add some line breaks there. If there is room and it is scrolling to the wrong place, play with the value 300 until it suits.

    Or, better yet, define a top margin for the page and include its value in the scroll:

    Code:
    <body style="margin-top:20px;" onload="window.scrollTo(0,320);">
    You still need enough room at the bottom of the page to allow it to scroll that far.
    Last edited by jscheuer1; 11-22-2005 at 11:25 PM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Nov 2005
    Location
    ankara / turkiye
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks for the code. this should serve me well enough for the pages i created. but think that i can't edit a.htm (may be a page on a site). is there any other way to do this.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Yes, make up your own page say, z.htm, have that show through your iframe. Put your scroll event on it, and have page a.htm show through it in yet another iframe.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Nov 2005
    Location
    ankara / turkiye
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    yeah that should work. thank again

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
  •