View Full Version : Removing Scrollbars from IFRAME..?

06-28-2007, 05:24 PM

Not as simple as the title would seem, I guess...

I'm working on a small HTML/Javascript/PHP using a flatfile text-based DB, Guestbook Script. I will do the formatting in CSS after it is functional. I'm not concerned about the flatfile....

My problem:

I have a FORM in an IFRAME, which can be hidden or made visible to collect the data then write it to the IFRAME. Everything works to this point, except, once you add a comment, hide the guestbook entries, then try to add another entry, scrollbars appear in the IFRAME, even though they don't appear the first time using the form.

I have SCROLLING for the IFRAME set to AUTO b/c the Guestbook entries will eventually need to be scrolled...

This happens in both IE 6, and Firefox 2.

Below is a link to the working script.

To test:

1. Add a comment.
2. Hide all comments.
3. Try to add another comment.


Any suggestions/idea on how to prevent the scrollbars appearing the second time around..?

06-28-2007, 09:41 PM
I finally figured out what is causing this....

If you add 2 comments, you get two pages inside of the iframe, 3 comments, 3 pages, etc...they were partially hidden, but I noticed the additional 2, 3, etc. pairs of scroll bars. I was nesting pages inside of the iframe, so I had to break it...

I was using
window.location.replace('addcomment.php'); to return to the main window.

I replaced that with
window.top.location.replace('addcomment.php'); and all is well....

06-29-2007, 04:53 AM
why dont you just do this:

stick this in your head:

function go(){
setTimeout(window.location='#bottom', 20000000);

<a name='bottom'>&nbsp;</a>
at the bottom of your page

then add this to your body tag:
<body onload='go()'>

and then set your iframe scroll=no

that way you will see all the latest posts.

edit: oh but then you wont be able to scroll. ok sorry never mind.