Scrollbar problem

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
artfhc
Forum Newbie
Posts: 23
Joined: Sun May 23, 2004 11:38 pm
Contact:

Scrollbar problem

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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

:)
artfhc
Forum Newbie
Posts: 23
Joined: Sun May 23, 2004 11:38 pm
Contact:

Post 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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that should do it.
artfhc
Forum Newbie
Posts: 23
Joined: Sun May 23, 2004 11:38 pm
Contact:

Post 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 :x any suggestion? Thx.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post the code.
artfhc
Forum Newbie
Posts: 23
Joined: Sun May 23, 2004 11:38 pm
Contact:

Post 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&#1111;0]: $arr&#1111;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. 8O
artfhc
Forum Newbie
Posts: 23
Joined: Sun May 23, 2004 11:38 pm
Contact:

Post by artfhc »

perhaps someone can help me :x ? please....
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

most likely html will only refresh without the #blah.
i could be mistaken
Post Reply