Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Removing Scrollbars from IFRAME..?

    Hi,

    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.

    http://motox.ekigroup.com/guesttest/...addcomment.php


    Any suggestions/idea on how to prevent the scrollbars appearing the second time around..?
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #2
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    625
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Code:
    window.location.replace('addcomment.php');
    to return to the main window.

    I replaced that with
    Code:
    window.top.location.replace('addcomment.php');
    and all is well....
    "God so loved the world that he gave his only begotten son, so that whosoever believed in him would not perish, but have everlasting life. For God did not send his son into the world to condemn the world, but so that through him the world might be saved. "

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Location
    New Zealand
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    why dont you just do this:

    stick this in your head:
    Code:
    <script>
    function go(){
    setTimeout(window.location='#bottom', 20000000);
    }
    </script>
    stick
    Code:
    <a name='bottom'>&nbsp;</a>
    at the bottom of your page

    then add this to your body tag:
    Code:
    <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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •