Page 1 of 1
Scrollbar problem
Posted: Sun Jun 27, 2004 10:37 pm
by artfhc
I am trying to make a chatting room, and it is doing okay. However the display message box, which is an iframe that connects an other php page, doesn't scroll down when the iframe refresh. How can I make the iframe scrollbar scroll down by itself to the bottom when everytime the iframe refresh? Perhaps I need to use javascript, but I am not familiar with it.
Posted: Sun Jun 27, 2004 10:44 pm
by feyd
easiest way is to quickly focus() and blur() something.. at least that's how I set it.. you could alternately use the hash as the refresh.. set the anchor like so:
Code: Select all
<a name="newest_post">some text</a>
then always refresh to:
http://yoursite.com/you_iframe.php#newest_post

Posted: Sun Jun 27, 2004 11:14 pm
by artfhc
I think u misunderstand what I was saying. From the begining till the end it has just one window. I want to scroll the <iframe> scrollbar down to the buttom everytime when it refreshes, but how?
Posted: Sun Jun 27, 2004 11:53 pm
by feyd
that should do it.
Posted: Mon Jun 28, 2004 4:13 am
by artfhc
sorry...finally get wat u are saying. But I still got a one big problem...after reload that page with that link, it wouldn't refresh anymore

any suggestion? Thx.
Posted: Mon Jun 28, 2004 4:56 am
by feyd
post the code.
Posted: Mon Jun 28, 2004 2:57 pm
by artfhc
Code: Select all
<html>
<head>
<title>ReadMessage</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<meta http-equiv="refresh" content = "2;URL=http://www.mydomain.com/watever.php#focus">
</head>
<body>
<?
$connection = mysql_connect("*****", "*****", "****");
mysql_select_db("*****", $connection);
$record = mysql_query("select username, message from table;");
while($arr = mysql_fetch_row($record))
echo("$arrї0]: $arrї1]<br>");
echo("<a name = "focus"></a>");
?>
</body>
</html>
The code above is the webpage that is <iframe>ed in another main page. I had been trying to use scrollTo(x, y) method in Javascript, but it doesn't work pretty well. It just stuck in 1/4 way down.

Posted: Thu Jul 01, 2004 2:43 pm
by artfhc
perhaps someone can help me

? please....
Posted: Sun Jul 04, 2004 11:28 am
by m3rajk
most likely html will only refresh without the #blah.
i could be mistaken