473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Import RSS XML URL launches Blank Window instead of Listings. Please help!!!!

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

http://www.washingtonpost.com/wp-dyn...tion/index.xml

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="Microsoft Wordpad>
<meta name="The 36th Project" content="Miscrosoft Wordpad">

<title>36th Project project</title>
<b><font size=6 face=bold>View Articles</font></b>

<div id=ReplaceMe>Enter XML file</div><BR>
<input id=T1 type=text style="width: 400"><P>
<input type=button value="Submit Query"
onclick="ReplaceMe.innerHTML = T1.value";>


</head>
<body>
<form>
<input type=button value="CONTINUE"
ONCLICK="importXML()";>
</form>
</body>

<script LANGUAGE=JavaScript>
[/HTML]
Expand|Select|Wrap|Line Numbers
  1. //create an instance of the XML parser
  2.  
  3. function importXML()
  4. {
  5. if (document.implementation && document.implementation.createDocument)
  6. {
  7. var hWin=window.open("","RSSINPUT","height=300,width=750,scrollbars=yes,toolbar=yes,location=yes,directo ries=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes");
  8. hWin.document.write("<HTML>\n<HEAD>\n<TITLE>XML&nbsp;Parse&nbsp;Result</TITLE>\n</HEAD>\n");
  9. hWin.document.write("<BO" + "DY>\n");
  10. hWin.document.write("<H2>I entered this URL, "http://www.washingtonpost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
  11.  
  12.  
  13. xmlDoc = document.implementation.createDocument("", "", null);
  14. xmlDoc.onload = createTable;
  15. }
  16. else if (window.ActiveXObject)
  17. {
  18.  
  19. var hWin=window.open("","RSSINPUT","height=300,width=750,scrollbars=yes,toolbar=yes,location=yes,directo ries=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes,resizable=yes");
  20. hWin.document.write("<HTML>\n<HEAD>\n<TITLE>XML&nbsp;Parse&nbsp;Result</TITLE>\n</HEAD>\n");
  21. hWin.document.write("<BO" + "DY>\n");
  22. hWin.document.write("<H2>I entered this URL, "http://www.washingtonpost.com/wp-dyn/rss/nation/index.xml", But This is blank?</H2>");
  23.  
  24.  
  25. xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  26. xmlDoc.async="false" //make sure doc is fully loaded
  27. xmlDoc.onreadystatechange = function () {
  28. if (xmlDoc.readyState == 4) createTable()};
  29. }
  30. else
  31. {
  32. if (xmlDoc.parseError.errorCode != 0) {
  33. var myError = xmlDoc.parseError;
  34. alert("You have error " + myError.reason);
  35.  
  36. }
  37. xmlDoc.load('ReplaceMe');
  38.  
  39. }
  40.  
  41. function createTable()
  42. {
  43.  
  44. var x = xmlDoc.getElementsBytagname("author");
  45. var newEl = document.createElement('TABLE');
  46. newEl.setAttribute('cellPadding',5);
  47. var tmp = document.createElement('TBODY');
  48. newEl.appendChild(tmp);
  49. var row = document.createElement('TR');
  50. for (j=0;j<x[0].childNodes.length;j++)
  51. {
  52. if (x[0].childNodes[j].nodeType != 1) continue;
  53. var container = document.createElement('TH');
  54. var theData = document.createTextNode(x[0].childNodes[j].nodeName);
  55. container.appendChild(theData);
  56. row.appendChild(container);
  57. }
  58. tmp.appendChild(row);
  59. for (i=0;i<x.length;i++)
  60. {
  61. var row = document.createElement('TR');
  62. for (j=0;j<x[i].childNodes.length;j++)
  63. {
  64. if (x[i].childNodes[j].nodeType != 1) continue;
  65. var container = document.createElement('TD');
  66. var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
  67. container.appendChild(theData);
  68. row.appendChild(container);
  69. }
  70. tmp.appendChild(row);
  71. }
  72. document.getElementById('writeroot').appendChild(newEl);
  73. }
  74. }
</script>

</html>
Feb 28 '08 #1
3 1758
acoder
16,027 Expert Mod 8TB
Move the HTML in the head (lines 10-15) into the body. Also move the JavaScript (which is currently outside the head and body) into the head section (with the script tags too).
Feb 28 '08 #2
Move the HTML in the head (lines 10-15) into the body. Also move the JavaScript (which is currently outside the head and body) into the head section (with the script tags too).

I tried that and it didn't work. I know why you suggested it though. But thanks
Feb 28 '08 #3
acoder
16,027 Expert Mod 8TB
See this script - it should be enough for your requirements.
Feb 28 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Clara | last post by:
Hi,... I meant to write an application where there is a button in a window and when you click on the button, it will open a new window, but I want the first window to close, replaced by the second...
4
by: Michael | last post by:
Hi, I create site with a prefix FramSet layout. The main page contains HTML <Form> function like this <Form name=my_form method=post action=my_action.asp> <input name=search_string ...
0
by: Wynter | last post by:
RE: from Displaying a Document using the ASPNET user account to the Client Browser discussion (3/2/2004 Buddy Thanks for helping me on getting the document to display. But now I am left with a...
14
by: Frances Del Rio | last post by:
I'm trying to open a url in a new window while pg loads (but NOT in a pop-up..) I need to do sthg like // while pg is loading.. window.location ='page.html' // but I need this to open in a...
1
by: Tavish Muldoon | last post by:
Hello, I have same Javascript that performs a little quiz after choose selections from radio buttons. It displays the number of answer that one got right. But it puts them in an alert box - I...
1
by: CYShao | last post by:
How to import an Office window? Hello. I want create a MS.Office.Excel or IE window on my C# form and edit some Excel files. How can I do that? Need I buy some licences from Microsoft? ...
6
by: EricR | last post by:
I am trying to bcp import a text file into a SQL Server 2000 database. The text file is coming out of a java application where order information is written to the text file. Each record is on it's...
3
by: TurtleGuy910 | last post by:
When I run my graphics program a blank window appears. Here is my source code: import java.awt.Graphics; import javax.swing.SwingUtilities; import javax.swing.JFrame; public class...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.