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 7 of 7
  1. #1
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts

    shoutbox iframe,,

    hey all,,,

    i have a shoutbox added to my site http://www.7des.com

    and it has a lil shout box that has the (submitted text) in a iframe that has a scroll bar,, can i make that so the bar will start from the bottom ? (last post) not first one,, thanx

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You mean you want the bar to be already scrolled to the bottom of the iframe when the page first loads? As far as I know it can't be done with PHP but I am sure I've seen this done with javascript before, I would suggest asking in the javascript forum. I know you can detect the position of the scrollbar so you must be able to set the position using a similar method but I wouldn't know how.

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts
    I made a shoutbox once using flat files, and to get it to store the new post on top I had it read the file into a variable, say $old, had the new post in a variable called $new and write $new to the file then append $old on the end of it.

    Hope that is helpfull in someway.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Give the iframe a name, then use the code below.
    Code:
    <script type="text/javascript">
    function setscroll(){
    parent.theiframename.scrollTo(0,500);//second value is iframe height
    }
    </script>
    Use onload="setscroll()" in your body tag.

  • #5
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    umm does not seem to work


    here are the codes i edited..

    PHP Code:
    <body onload="setscroll()"
    PHP Code:
    <script type="text/javascript">
    function 
    setscroll(){
    parent.sbox.scrollTo(0,100);//second value is iframe height
    }
    </script>

    <table class="content" width="150" height="7">
    <tr>
    <td valign="bottom" class"content"><font face="Verdana, Arial, Helvetica, sans-serif" size="1">
    <iframe name="I1" src="shoutbox/frame.php" marginwidth="0" marginheight="0" border="0" frameborder="0" width="140" height="100" class="content" name="sbox">
    Your browser does not support inline frames or is currently configured not to display inline frames.
    </iframe></font></td> 

    thanx

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    you have two names declared
    Code:
    <iframe name="I1" src="shoutbox/frame.php" marginwidth="0" marginheight="0" border="0" frameborder="0" width="140" height="100" class="content" name="sbox">
    by default it reads the first name declared in this case is I1

  • #7
    Regular Coder
    Join Date
    May 2005
    Posts
    116
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ohh ohh yeah it worked,,, i just set the hight to "100000000000000" so it would go to the bottom lol! :P


    thanx every one


  •  

    Posting Permissions

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