Hallo,
ich möchte ein Chatfenster zur letzten Nachricht scrollen lassen. Bisher ging das ganz gut. jetzt habe ich die Seite umgebaut mit einen DIV-Container. Da klappt es nicht mehr.
So sieht der neue Quelltext aus
Im alten quellcode war dann das bodyID im body tag
ich möchte ein Chatfenster zur letzten Nachricht scrollen lassen. Bisher ging das ganz gut. jetzt habe ich die Seite umgebaut mit einen DIV-Container. Da klappt es nicht mehr.
So sieht der neue Quelltext aus
Code:
<html> <head> <script> function reloadPage() { window.location.reload(true); } setInterval("reloadPage()",8000); </script></head> <body leftmargin="0" marginheight="0" marginwidth="0" topmargin="0" > <table width="385" border="0" cellspacing="0" cellpadding="0" cool gridx="16" gridy="16" height="250" showgridx showgridy> <tr height="16"> <td width="12" height="249" rowspan="2"></td> <td width="372" height="16"></td> <td width="1" height="16"><spacer type="block" width="1" height="16"></td> </tr> <tr height="233"> <td width="372" height="233" valign="top" align="left" xpos="12"> <div id="bodyID" style="width:350px; border:1px solid #5868B0; height:210px; background-color:#e0f5e0; overflow:scroll;"> <? include("sql.inc.php"); $sqlbefehl = "SELECT * FROM messages where session='$session'"; $result = mysql_query($sqlbefehl,$verbindung); while($row = mysql_fetch_object($result)) { if($row->name==Roland) { echo"<font face=arial size=2 color=black>$row->name: $row->message ";} else { echo"<font face=arial size=2 color=red >$row->name: $row->message ";} } ?></div> </td> <td width="1" height="233"><spacer type="block" width="1" height="233"></td> </tr> <tr height="1" cntrlrow> <td width="12" height="1"><spacer type="block" width="12" height="1"></td> <td width="372" height="1"><spacer type="block" width="372" height="1"></td> <td width="1" height="1"></td> </tr> </table> </body> <script> document.body.scrollTop = document.all['bodyID'].offsetHeight + 10000000; </script> </html>
Kommentar