R
rjones326
Hi,
I'm stupendously mystified by this strange activity. I cannot for the
life of me figure out why this will not work in mozilla. I've spent
hours mucking around with it. The php file is just an echo statement
now to simplify for the moment. If instead of calling the replace
function I've also tried putting in an alert function. Alert works,
the calling the php file does not.
Any suggestions greatly appreciated, I've never encountered such
difficult functionality as with javascript in firefox compared to IE.
Might just be my luck though...
<html>
<head>
<script language="javascript" type="text/javascript">
var url = "poo.php?pc=" ;
function aHttpResponse() {
if (http.readystate == 4) {
results = http.responseText ;
document.getElementById('state').value=http.responseText ;
}
}
function fiction(){
alert("yes") ;
}
function callPHPResponse() {
var pcode = document.getElementById("postcode").value ;
http.open("GET",url+escape(pcode),true) ;
http.onreadystatechange = aHttpResponse ;
http.send(null) ;
}
function getHTTPObject() {
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
return http_request ;
}
var http = getHTTPObject() ;
</script>
</head>
<form action="post">
<table width="800">
<td width="100">Postcode</td>
<td width="700"><input type="text" name="postcode" id="postcode"
size="5" onblur="callPHPResponse();"></td>
</tr>
<tr>
<td width="100">State</td>
<td width="700"><input type="text" name="state" id="state"
size="50"></td>
</tr>
<tr>
</table>
</form>
</html>
I'm stupendously mystified by this strange activity. I cannot for the
life of me figure out why this will not work in mozilla. I've spent
hours mucking around with it. The php file is just an echo statement
now to simplify for the moment. If instead of calling the replace
function I've also tried putting in an alert function. Alert works,
the calling the php file does not.
Any suggestions greatly appreciated, I've never encountered such
difficult functionality as with javascript in firefox compared to IE.
Might just be my luck though...
<html>
<head>
<script language="javascript" type="text/javascript">
var url = "poo.php?pc=" ;
function aHttpResponse() {
if (http.readystate == 4) {
results = http.responseText ;
document.getElementById('state').value=http.responseText ;
}
}
function fiction(){
alert("yes") ;
}
function callPHPResponse() {
var pcode = document.getElementById("postcode").value ;
http.open("GET",url+escape(pcode),true) ;
http.onreadystatechange = aHttpResponse ;
http.send(null) ;
}
function getHTTPObject() {
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) { // IE
http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
return http_request ;
}
var http = getHTTPObject() ;
</script>
</head>
<form action="post">
<table width="800">
<td width="100">Postcode</td>
<td width="700"><input type="text" name="postcode" id="postcode"
size="5" onblur="callPHPResponse();"></td>
</tr>
<tr>
<td width="100">State</td>
<td width="700"><input type="text" name="state" id="state"
size="50"></td>
</tr>
<tr>
</table>
</form>
</html>