Salve,

Voglio realizzare una chat ASP che tramite Ajax mostra gli utenti on-line & i messaggi scritti.

La parte in Asp ho sistemata Io creando 2 file:

messeggi.asp
Che serve a mostrare i messaggi con gli smile ed il testo formattato.

utenti.asp
Che serve a mostrare gli utenti on-line.

Il problema però è la parte in Ajax:

Devo fare visualizzare in un div i messaggi e in un'altro div gli utenti on-line e poi sempre tramite ajax aggiornare ogni tot. secondi.

inoltre devo fare un sistema per l'invio dei messaggi e la visualizzazione istantanea di essi sempre tramite ajax.

Questa è la base che ho creato:

codice:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>SuperChat v. 1.0</title>
<script type="text/javascript">

	window.setInterval('aggiorna()',2000);
	
	var xmlHttp
	
	// - - - - - - - - - - - - - - - - - -
	function aggiorna() {
		
		var url = "messaggi.asp?rd=" + Math.random()
		
		xmlHttp=GetXmlHttpObject(messaggi)
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
	} 
	
	// - - - - - - - - - - - - - - - - - -
	function messaggi() {
		if (xmlHttp.readyState == 4) {
			if (xmlHttp.status == 200 || xmlHttp.status == 0) {
				document.getElementById("messaggi").innerHTML=xmlHttp.responseText
			} else {
				alert("Errore !");
			}
		}
	}
	
	// - - - - - - - - - - - - - - - - - -
	function GetXmlHttpObject(handler) {
		
		var objXmlHttp = null
		
		if (window.XMLHttpRequest) {
			objXmlHttp = new XMLHttpRequest();
		} else {
			objXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// - - - - - - - - - - - - - - - - - -
		try {
			objXmlHttp.onreadystatechange = handler
			return objXmlHttp
		} catch (e) {
			alert("Errore !")
			return
		}
	}

</script>
</head>

<body>
	<div id="contenitore">
		<div id="testata">
			<h1>SuperChat v. 1.0</h1>
		</div>
		<div id="chat">
			<div id="messaggi">
				

Messaggi</p>
			</div>
			<div id="utenti">
				

Utenti</p>
			</div>
			<div id="editor">
				<form id="nuovo" method="post" action="#">
					

<label for="msg">Scrivi: <input name="msg" type="text" id="msg" size="80" /></label></p>
				</form>
			</div>
		</div>
	</div>
</body>
</html>
Chi mi aiuta a fare la parte in Ajax ?

grazie mille !