bonjour,
j'ai intégrer un chat à mon blog
http://www.linuxuser.at/chat/index.html
Mais comme je n'y connais rien j'ai beaucoup de mal à personnaliser ses fonctions.
Dans un 1er temps je cherche à forcer la fenêtre du chat à afficher le dernier message pour ne pas avoir à descendre en permanence l'ascenseur
peut-être que le code suivant est un début de solution ?
si c'est le bon code (?) je ne sais pas ou l'utiliser non plus...
voici le javascript de mon chat:
si quelqu'un peut m'aider merci d'avance
++
j'ai intégrer un chat à mon blog
http://www.linuxuser.at/chat/index.html
Mais comme je n'y connais rien j'ai beaucoup de mal à personnaliser ses fonctions.
Dans un 1er temps je cherche à forcer la fenêtre du chat à afficher le dernier message pour ne pas avoir à descendre en permanence l'ascenseur
peut-être que le code suivant est un début de solution ?
var intElemScrollHeight = document.getElementById('id').scrollHeight;
si c'est le bon code (?) je ne sais pas ou l'utiliser non plus...
voici le javascript de mon chat:
<script type="text/javascript">
/****************************************************************
* Most Simple Ajax Chat Script (www.linuxuser.at) *
* Version: 3.1 *
* *
* Author: Chris (chris[at]linuxuser.at) *
* Contributors: Derek, BlueScreenJunky (http://forums.linuxuser.at/viewtopic.php?f=6&t=17)
* *
* Licence: GPLv2 *
****************************************************************/
/* Settings you might want to define */
var waittime=800;
/* Internal Variables & Stuff */
document.getElementById("chatmsg");
/*chatmsg.focus()*/
document.getElementById("chatwindow").innerHTML = "chargement...";
var xmlhttp = false;
var xmlhttp2 = false;
/* Request for Reading the Chat Content */
function ajax_read(url) {
if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
if(xmlhttp.overrideMimeType){
xmlhttp.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject){
try{
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e){
}
}
}
if(!xmlhttp) {
alert('Giving up [decu] Cannot create an XMLHTTP instance');
return false;
}
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
document.getElementById("chatwindow").innerHTML = xmlhttp.responseText;
zeit = new Date();
ms = (zeit.getHours() * 24 * 60 * 1000) + (zeit.getMinutes() * 60 * 1000) + (zeit.getSeconds() * 1000) + zeit.getMilliseconds();
intUpdate = setTimeout("ajax_read('chat.txt?x=" + ms + "')", waittime)
}
}
xmlhttp.open('GET',url,true);
xmlhttp.send(null);
}
/* Request for Writing the Message */
function ajax_write(url){
if(window.XMLHttpRequest){
xmlhttp2=new XMLHttpRequest();
if(xmlhttp2.overrideMimeType){
xmlhttp2.overrideMimeType('text/xml');
}
} else if(window.ActiveXObject){
try{
xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try{
xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
} catch(e){
}
}
}
if(!xmlhttp2) {
alert('Giving up [decu] Cannot create an XMLHTTP instance');
return false;
}
xmlhttp2.open('GET',url,true);
xmlhttp2.send(null);
}
/* Submit the Message */
function submit_msg(){
nick = document.getElementById("chatnick").value;
msg = document.getElementById("chatmsg").value;
if (nick == "") {
check = prompt("please enter username:");
if (check === null) return 0;
if (check == "") check = "anonymous";
document.getElementById("chatnick").value = check;
nick = check;
}
document.getElementById("chatmsg").value = "";
ajax_write("chat.php?m=" + msg + "&n=" + nick);
}
/* Check if Enter is pressed */
function keyup(arg1) {
if (arg1 == 13) submit_msg();
}
/* Start the Requests! [cligne] */
var intUpdate = setTimeout("ajax_read('chat.txt')", waittime);
</script>
si quelqu'un peut m'aider merci d'avance

++