Ajax firefox BUG
Det her script virker fint i Internet explorer men ikke i Firefox<!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>
<title>ajax</title>
<script language="javascript" type="text/javascript">
var url = "MINURL?p="; // The server-side script
var responseText = "";
function handleHttpResponse() {
if (http.readyState == 4) {
// Split the comma delimited response into an array
if(http.responseText == "XXX")
{
alert("Ingen oplysninger fundet!");
document.getElementById("firma").value= "";
}
else
{
results = http.responseText.split("___");
document.getElementById('firma').value= results[0]+" "+results[1];
}
}
}
function updateCityState() {
var zipValue = document.getElementById("zip").value;
http.open("GET", url + escape(zipValue), true);
http.onreadystatechange = handleHttpResponse;
http.send(null);
}
function getHTTPObject() {
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;
}
}
return xmlhttp;
}
var http = getHTTPObject(); // We create the HTTP Object
</script>
</head>
<body>
<form action="post">
<p>
<p>
TLF code:
<input type="text" size="10" name="zip" id="zip" onblur="updateCityState();" />
</p>
firma:
<input type="text" name="firma" id="firma" />
State:
</form>
</body>
</html>
