Sun Mar 18, 2012 12:55 pm
Hi,
I have used the following code that works perfectly well with I.E., but does not display anything with Firefox:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<HEAD>
<TITLE></TITLE>
<SCRIPT language = "javascript" TYPE = "text/javascript">
<!-- Start hiding JavaScript statements
var Request = false;
if (window.XMLHttpRequest) {
Request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
Request = new ActiveXObject("Microsoft.XMLHTTP");
}
function Display(url) {
if(Request) {
Request.open("GET", url);
Request.onreadystatechange = function()
{
if (Request.readyState == 4 && Request.status == 200) {
ModifyDOM(Request.responseText)
}
}
Request.send(null);
}
}
function ModifyDOM(storyText) {
var newText = document.createTextNode(storyText);
var newLine = document.createElement("<br/>");
document.getElementById('trgtP').appendChild(newText);
document.getElementById('trgtP').appendChild(newLine);
}
End hiding JavaScript statements -->
</SCRIPT>
</HEAD>
<BODY>
<table>
<tr>
<td><img src="xyz.jpg" width = 200 height = 200/></td>
<td><p id = "trgtP"></td>
</tr>
<tr>
<td colspan="3"><a href="#" onclick = "Display('Color.txt')">Colors Available</a></td>
</tr>
</table>
<hr/>
</BODY>
</HTML>
Could you please help me... I have just started using AJAX and I can't understand why no results is displayed using firefox, even if I inserted a set of coding at the top that is supposed to support different browsers.
Thanks,
Joey
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.