scriptet er her, håber du kan tilpasse
<HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html>
<head>
<title>test af chat iframe</title>
<script type="text/javascript">
var chat, fakeno = 0;
// indsætter ny tekst hele tiden...
function fake_chat () {
chat.appendChatText ('Ged_' + ++fakeno + ':' +
'[er vi tæt på bunden...: :' + chat.dist + ']');
if (fakeno < 30) setTimeout ('fake_chat()', 600);
}
window.onload = function () {
chat = new ChatFrame ('chat_vindue');
fake_chat();
};
/**************************************************
skrevet af jakob lund
jalun2 AT edu DOT kts DOT dk
respekter det eller dø
**************************************************/
function ChatFrame (id) {
//the id must be BOTH the id AND name attribute of the <iframe>
this.win = window[id];
this.bodyElement = this.win.document.body||this.win.document.getElementsByTagName('BODY')[0];
this.outer_height = document.getElementById (id).height;
this.updateHeightValues();
}
ChatFrame.prototype.updateHeightValues = function () {
this.height_value = this.bodyElement.offsetHeight;
this.atBottom = this.height_value - (this.bodyElement.scrollTop||this.win.pageYOffset) - this.outer_height < 1;
}
ChatFrame.prototype.appendChatText = function (s) {
this.updateHeightValues();
var wasAtBottom = this.atBottom, p = this.win.document.createElement('p');
p.appendChild (this.win.document.createTextNode (s));
this.win.document.getElementById('chattxt').appendChild (p);
this.updateHeightValues();
if (wasAtBottom)
this.win.scrollTo (0,this.height_value);
}
</script>
</head>
<body>
<iframe name="chat_vindue" id="chat_vindue" width="250" height="220" src="chatskelet.html" scrolling="auto"></iframe>
</body>
</html>
der skal også være et dokument "chatskelet.html", med en div med id "chattxt"