das
04-12-2008, 17:53
Ho trovato questo esempio su internet:
[NomeFile=xmlhttp.js]
var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp=false;
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
[NomeFile=Index.html]
<script src="xmlhttp.js" type="text/javascript">
xmlhttp=false
</script>
<script type="text/javascript">
if (xmlhttp) {
document.write('<p class="example"><a href="#" onclick="example2();return false;">Try the example 2.</a></p>')
}
function example2() {
xmlhttp.open("HEAD", "http://www.jibbering.com/faq/index.html",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.getAllResponseHeaders())
}
}
xmlhttp.send(null)
}
Su Internet Explorer, mi avvisa che lo script potrebbe essere insicuro ma funziona, su firefox invece niente. Quando clicco su example 2 non fa nulla.
Qualcuno sa perchè ?
Thanks
[NomeFile=xmlhttp.js]
var xmlhttp
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp=false;
}
}
@else
xmlhttp=false
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp=false;
}
}
if (!xmlhttp && window.createRequest) {
try {
xmlhttp = window.createRequest();
} catch (e) {
xmlhttp=false;
}
}
[NomeFile=Index.html]
<script src="xmlhttp.js" type="text/javascript">
xmlhttp=false
</script>
<script type="text/javascript">
if (xmlhttp) {
document.write('<p class="example"><a href="#" onclick="example2();return false;">Try the example 2.</a></p>')
}
function example2() {
xmlhttp.open("HEAD", "http://www.jibbering.com/faq/index.html",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
alert(xmlhttp.getAllResponseHeaders())
}
}
xmlhttp.send(null)
}
Su Internet Explorer, mi avvisa che lo script potrebbe essere insicuro ma funziona, su firefox invece niente. Quando clicco su example 2 non fa nulla.
Qualcuno sa perchè ?
Thanks