...

View Full Version : shoutbox iframe,,



muhaidib
06-12-2005, 10:50 PM
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 :)

delinear
06-13-2005, 11:12 AM
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.

Riboflavin
06-13-2005, 11:31 AM
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.

_Aerospace_Eng_
06-13-2005, 11:55 AM
Give the iframe a name, then use the code below.

<script type="text/javascript">
function setscroll(){
parent.theiframename.scrollTo(0,500);//second value is iframe height
}
</script>
Use onload="setscroll()" in your body tag.

muhaidib
06-13-2005, 05:52 PM
umm does not seem to work :(


here are the codes i edited..


<body onload="setscroll()">


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

_Aerospace_Eng_
06-13-2005, 07:42 PM
you have two names declared

<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

muhaidib
06-14-2005, 12:44 AM
ohh ohh yeah it worked,,, i just set the hight to "100000000000000" so it would go to the bottom lol! :P


thanx every one :D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum