LikwidN2
05-20-2007, 10:29 PM
Since my first post got lost in the tubes on its way here, this one will be much briefer and less eloquent. This is my first crack at web scripting, and very early in the game I'm hitting a road block. I'll give a brief intro to the project: The ultimate goal is a Google Homepage Gadget that reads XML data (hosted and maintained by a third party) and displays relevant information (a schedule of sorts). I am hoping to use Javascript and DOM in one HTML page to do this. My development platform is FrontPage 2003. The code at this point is very short, so I will break guidelines and post the entire thing:
<html>
<head>
<script type="text/javascript">
var xmlDoc;
var strOut;
function loadXML(){
// code for IE
if (window.ActiveXObject){
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("viewteam_v2.asp.xml");
setupTeam();
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation &&
document.implementation.createDocument){
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("viewteam_v2.asp.xml");
setupTeam();
}
else
{
alert('Your browser cannot handle this script');
}
}
function setupTeam(){
strOut += xmlDoc.getElementsByTagName("name")[0].nodeValue;
}
document.write(strOut);
</script>
</head>
<body onload="loadXML()">
</body>
</html>
This code is just trying to pull a sample from the XML data (with the browser compatibility code I copy and pasted while reading the tutorial at W3Schools - my only training). I'll post the related XML snippet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<team>
<teaminformation>
<name>][Bracket Clan][</name>
<url>http://bracketcl.......
I currently get two errors:
The first error I get is an "Access Denied" error at the load() call [line 11]. I get this when using the "Preview" function in FP, but not when I load the page in Mozilla. I have the XML file downloaded to the same local directory as the HTML file for the initial testing.
The second "error" is not an actual error, but a problem: In both Mozilla and FP, the output of the page is "undefined".
It appears that the XML data is not being loaded into xmlDoc.
I'm going to need a ton of help on this project - which is going to be a learning experience for me without a doubt. The project is a hobby cause and is not mission critical. If completed, however, it could be used by hundreds of people that use the services of this third party. So if anyone is willing/interested in becoming a mentor - it will be easier to work with one person that has some background/familiarity with the project than to post here every time I can't dig myself out of a hole - it would be greatly appreciated.
<html>
<head>
<script type="text/javascript">
var xmlDoc;
var strOut;
function loadXML(){
// code for IE
if (window.ActiveXObject){
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("viewteam_v2.asp.xml");
setupTeam();
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation &&
document.implementation.createDocument){
xmlDoc=document.implementation.createDocument("","",null);
xmlDoc.load("viewteam_v2.asp.xml");
setupTeam();
}
else
{
alert('Your browser cannot handle this script');
}
}
function setupTeam(){
strOut += xmlDoc.getElementsByTagName("name")[0].nodeValue;
}
document.write(strOut);
</script>
</head>
<body onload="loadXML()">
</body>
</html>
This code is just trying to pull a sample from the XML data (with the browser compatibility code I copy and pasted while reading the tutorial at W3Schools - my only training). I'll post the related XML snippet:
<?xml version="1.0" encoding="ISO-8859-1"?>
<team>
<teaminformation>
<name>][Bracket Clan][</name>
<url>http://bracketcl.......
I currently get two errors:
The first error I get is an "Access Denied" error at the load() call [line 11]. I get this when using the "Preview" function in FP, but not when I load the page in Mozilla. I have the XML file downloaded to the same local directory as the HTML file for the initial testing.
The second "error" is not an actual error, but a problem: In both Mozilla and FP, the output of the page is "undefined".
It appears that the XML data is not being loaded into xmlDoc.
I'm going to need a ton of help on this project - which is going to be a learning experience for me without a doubt. The project is a hobby cause and is not mission critical. If completed, however, it could be used by hundreds of people that use the services of this third party. So if anyone is willing/interested in becoming a mentor - it will be easier to work with one person that has some background/familiarity with the project than to post here every time I can't dig myself out of a hole - it would be greatly appreciated.