Salve amici,
allora vorrei far scorrere dei dati in un div prelevati da un database con Ajax e ASP:
e questo è il codice HTML:codice:<script type="text/javascript"> var XMLHTTP; function Richiesta(pagina) { if (pagina.length > 0) { XMLHTTP = RicavaBrowser(CambioStato); XMLHTTP.open("GET", "inc_dati.asp?pag=" + Pagina, true); XMLHTTP.send(null); } else { document.getElementById("risultati").innerHTML = ""; } } function CambioStato() { if (XMLHTTP.readyState == 4) { var R = document.getElementById("risultati"); R.innerHTML = XMLHTTP.responseText; } } function RicavaBrowser(QualeBrowser) { if (navigator.userAgent.indexOf("MSIE") != (-1)) { var Classe = "Msxml2.XMLHTTP"; if (navigator.appVersion.indexOf("MSIE 5.5") != (-1)); { Classe = "Microsoft.XMLHTTP"; } try { OggettoXMLHTTP = new ActiveXObject(Classe); OggettoXMLHTTP.onreadystatechange = QualeBrowser; return OggettoXMLHTTP; } catch(e) { alert("Errore: l'ActiveX non verrà eseguito!"); } } else if (navigator.userAgent.indexOf("Mozilla") != (-1)) { OggettoXMLHTTP = new XMLHttpRequest(); OggettoXMLHTTP.onload = QualeBrowser; OggettoXMLHTTP.onerror = QualeBrowser; return OggettoXMLHTTP; } else { alert("L'esempio non funziona con altri browser!"); } } </script>
Il problema è che non mi funziona! Ovviamente nella pagina ASP passo con request.querystring il valore del numero di record che voglio visualizzare!codice:<ul id="risultati">[/list] <button id="pagina" type="button" value="10" onClick="richiesta(this.value)">altre...</button>

Rispondi quotando