This is a xmlDoc.load routine through either IE or Firefox. An RSS URL is loaded into a form. After Onclick of a button a second window is launched and a parsed listing of the original RSS file is supposed to display in a separate window. But I am getting a blank page instead. I've tried this hundred of different waya, including using innerHTML, and or shifting the javascript to the bottom of the page (I thought it might have something to do with the javascript executing before the page was loaded). I cannot use <body onload> because everything must occur after onclicks. So the onclicks are in the header (DHTML), and I've shifted the javascript to the bottom of the page. Please help!!!!!
You can use the following RSS
HERE'S THE CODE:
[HTML]
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR " content="Micros oft Wordpad>
<meta name="The 36th Project" content="Miscro soft Wordpad">
<title>36th Project project</title>
<b><font size=6 face=bold>View Articles</font></b>
<div id=ReplaceMe>En ter XML file</div><BR>
<input id=T1 type=text style="width: 400"><P>
<input type=button value="Submit Query"
onclick="Replac eMe.innerHTML = T1.value";>
</head>
<body>
<form>
<input type=button value="CONTINUE "
ONCLICK="import XML()";>
</form>
</body>
<script LANGUAGE=JavaSc ript>
[/HTML]
[CODE=javascript]//create an instance of the XML parser
function importXML()
{
if (document.imple mentation && document.implem entation.create Document)
{
var hWin=window.ope n("","RSSINPUT" ,"height=300,wi dth=750,scrollb ars=yes,toolbar =yes,location=y es,directo ries=yes,status =yes,menubar=ye s,scrollbars=ye s,copyhistory=y es,resizable=ye s");
hWin.document.w rite("<HTML>\n< HEAD>\n<TITLE>X ML Parse&n bsp;Result</TITLE>\n</HEAD>\n");
hWin.document.w rite("<BO" + "DY>\n");
hWin.document.w rite("<H2>I entered this URL, "http://www.washingtonp ost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
xmlDoc = document.implem entation.create Document("", "", null);
xmlDoc.onload = createTable;
}
else if (window.ActiveX Object)
{
var hWin=window.ope n("","RSSINPUT" ,"height=300,wi dth=750,scrollb ars=yes,toolbar =yes,location=y es,directo ries=yes,status =yes,menubar=ye s,scrollbars=ye s,copyhistory=y es,resizable=ye s");
hWin.document.w rite("<HTML>\n< HEAD>\n<TITLE>X ML Parse&n bsp;Result</TITLE>\n</HEAD>\n");
hWin.document.w rite("<BO" + "DY>\n");
hWin.document.w rite("<H2>I entered this URL, "http://www.washingtonp ost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async="f alse" //make sure doc is fully loaded
xmlDoc.onreadys tatechange = function () {
if (xmlDoc.readySt ate == 4) createTable()};
}
else
{
if (xmlDoc.parseEr ror.errorCode != 0) {
var myError = xmlDoc.parseErr or;
alert("You have error " + myError.reason) ;
}
xmlDoc.load('Re placeMe');
}
function createTable()
{
var x = xmlDoc.getEleme ntsBytagname("a uthor");
var newEl = document.create Element('TABLE' );
newEl.setAttrib ute('cellPaddin g',5);
var tmp = document.create Element('TBODY' );
newEl.appendChi ld(tmp);
var row = document.create Element('TR');
for (j=0;j<x[0].childNodes.len gth;j++)
{
if (x[0].childNodes[j].nodeType != 1) continue;
var container = document.create Element('TH');
var theData = document.create TextNode(x[0].childNodes[j].nodeName);
container.appen dChild(theData) ;
row.appendChild (container);
}
tmp.appendChild (row);
for (i=0;i<x.length ;i++)
{
var row = document.create Element('TR');
for (j=0;j<x[i].childNodes.len gth;j++)
{
if (x[i].childNodes[j].nodeType != 1) continue;
var container = document.create Element('TD');
var theData = document.create TextNode(x[i].childNodes[j].firstChild.nod eValue);
container.appen dChild(theData) ;
row.appendChild (container);
}
tmp.appendChild (row);
}
document.getEle mentById('write root').appendCh ild(newEl);
}
}[/CODE]
</script>
</html>
You can use the following RSS
HERE'S THE CODE:
[HTML]
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR " content="Micros oft Wordpad>
<meta name="The 36th Project" content="Miscro soft Wordpad">
<title>36th Project project</title>
<b><font size=6 face=bold>View Articles</font></b>
<div id=ReplaceMe>En ter XML file</div><BR>
<input id=T1 type=text style="width: 400"><P>
<input type=button value="Submit Query"
onclick="Replac eMe.innerHTML = T1.value";>
</head>
<body>
<form>
<input type=button value="CONTINUE "
ONCLICK="import XML()";>
</form>
</body>
<script LANGUAGE=JavaSc ript>
[/HTML]
[CODE=javascript]//create an instance of the XML parser
function importXML()
{
if (document.imple mentation && document.implem entation.create Document)
{
var hWin=window.ope n("","RSSINPUT" ,"height=300,wi dth=750,scrollb ars=yes,toolbar =yes,location=y es,directo ries=yes,status =yes,menubar=ye s,scrollbars=ye s,copyhistory=y es,resizable=ye s");
hWin.document.w rite("<HTML>\n< HEAD>\n<TITLE>X ML Parse&n bsp;Result</TITLE>\n</HEAD>\n");
hWin.document.w rite("<BO" + "DY>\n");
hWin.document.w rite("<H2>I entered this URL, "http://www.washingtonp ost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
xmlDoc = document.implem entation.create Document("", "", null);
xmlDoc.onload = createTable;
}
else if (window.ActiveX Object)
{
var hWin=window.ope n("","RSSINPUT" ,"height=300,wi dth=750,scrollb ars=yes,toolbar =yes,location=y es,directo ries=yes,status =yes,menubar=ye s,scrollbars=ye s,copyhistory=y es,resizable=ye s");
hWin.document.w rite("<HTML>\n< HEAD>\n<TITLE>X ML Parse&n bsp;Result</TITLE>\n</HEAD>\n");
hWin.document.w rite("<BO" + "DY>\n");
hWin.document.w rite("<H2>I entered this URL, "http://www.washingtonp ost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async="f alse" //make sure doc is fully loaded
xmlDoc.onreadys tatechange = function () {
if (xmlDoc.readySt ate == 4) createTable()};
}
else
{
if (xmlDoc.parseEr ror.errorCode != 0) {
var myError = xmlDoc.parseErr or;
alert("You have error " + myError.reason) ;
}
xmlDoc.load('Re placeMe');
}
function createTable()
{
var x = xmlDoc.getEleme ntsBytagname("a uthor");
var newEl = document.create Element('TABLE' );
newEl.setAttrib ute('cellPaddin g',5);
var tmp = document.create Element('TBODY' );
newEl.appendChi ld(tmp);
var row = document.create Element('TR');
for (j=0;j<x[0].childNodes.len gth;j++)
{
if (x[0].childNodes[j].nodeType != 1) continue;
var container = document.create Element('TH');
var theData = document.create TextNode(x[0].childNodes[j].nodeName);
container.appen dChild(theData) ;
row.appendChild (container);
}
tmp.appendChild (row);
for (i=0;i<x.length ;i++)
{
var row = document.create Element('TR');
for (j=0;j<x[i].childNodes.len gth;j++)
{
if (x[i].childNodes[j].nodeType != 1) continue;
var container = document.create Element('TD');
var theData = document.create TextNode(x[i].childNodes[j].firstChild.nod eValue);
container.appen dChild(theData) ;
row.appendChild (container);
}
tmp.appendChild (row);
}
document.getEle mentById('write root').appendCh ild(newEl);
}
}[/CODE]
</script>
</html>
Comment