Log in

View Full Version : iframe



cadaver
11-22-2005, 09:48 PM
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.

jscheuer1
11-22-2005, 11:18 PM
On a.htm use this as an onload event in the body tag (highlight red):


<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:


<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.

cadaver
11-22-2005, 11:25 PM
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.

jscheuer1
11-22-2005, 11:28 PM
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.

cadaver
11-23-2005, 06:07 PM
yeah that should work. thank again