Click to See Complete Forum and Search --> : Chatroom with javascript scrolling problems...


Zero-x252
08-10-2003, 11:37 AM
I need this page to stay scrolled to the bottom but i am not sure how to code that can someone please help me?
<html>
<head>

<script type="text/javascript">
<!--
function display(text) {
var message = text
var name = document.name.user.value
var disp = '<br>&lt;' + name + '&gt;:' + message
var show = document.getElementById('displayArea').innerHTML + disp;
document.getElementById('displayArea').innerHTML = show
return false;
}
//-->
</script>
</head>
<body>
<br /><br />
<div id="displayArea"></div>
<form name="form1" onSubmit="return display(this.text1.value);">
<input type="text" name="text1" maxlength="55" size="105" />
</form>
<form name="name">
name:<input type="text" name="user" maxlength="10" size="95">
</form>
</body>
</html>

AdamGundry
08-10-2003, 01:07 PM
After you add to the innerHTML, you can scroll the window using this (assuming you are adding no more than 10000 pixels of content - there might be a more efficient way to do this):

window.scrollBy(0, 10000);

Adam