...

View Full Version : help it keep giving error... :(



guowei1000
06-22-2004, 09:12 AM
it said method not supported at line 97 ... can anyone help me ? its around the area i put HERE... its not included in the code of course but i just wanna to show where the error was
<html>
<head>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("note.xml");
function TestChildren(nodes) // write the first layer out
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
document.writeln("<A onClick='javaScript:toogle_state(this)'><font color= red><IMG SRC='minus.gif'>"+ nodes.nodeName +"</font></A>");
if (nodes.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < nodes.childNodes.length; i++)
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (nodes.childNodes(i).hasChildNodes) // add toogle in
{
if(nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
}
else
{
if (nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + nodes.childNodes(i).nodeName + "</A>");
}
else
{
document.writeln(nodes.childNodes(i).nodeName);
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
document.writeln("</DIV>");
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
function writechildren(sianz)
{
if (sianz.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < sianz.childNodes.length; i++) // check the length of the childNOdes
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (sianz.childNodes(i).hasChildNodes) // add toogle in
{
if (sianz.childNodes(i).nodeName == "#text")
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}

}
}
else
{
if(sianz.childNodes(i).nodeName == "#text")
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + sianz.childNodes(i).text + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).text);
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy" + ">" + sianz.childNodes(i).nodeName + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).nodeName);
writechildren(sianz.childNodes(i))
}
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
}
}

function toogle_state(nodeCounter) // this toogle the state and pass info to the sideView.html side
{
var location = nodeCounter.sourceIndex // locate the location of the nodeCounter
var locationIMG = document.all[location + 1] //this locate the IMG tag for this
var nextDivLocation = document.all[location+2] // location the DIV
if (nextDivLocation.style.display =="")
{
nextDivLocation.style.display = "none"
locationIMG.src = "plus.gif";
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
//var stFrame = parent.frames['sidethingy']; // pass data to the other frame
//stFrame.controlText(nextDivLocation.innerText);
}
}
function callReadXml()
{
root = xmlDoc.documentElement;
TestChildren(root);
}
</script>
</head>
<body>
<script type="text/javascript">
callReadXml();
</script>
</body>
</html>

guowei1000
06-22-2004, 09:15 AM
sry for the double post, forget to add in the "HERE"

<html>
<head>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("note.xml");
function TestChildren(nodes) // write the first layer out
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
document.writeln("<A onClick='javaScript:toogle_state(this)'><font color= red><IMG SRC='minus.gif'>"+ nodes.nodeName +"</font></A>");
if (nodes.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < nodes.childNodes.length; i++)
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (nodes.childNodes(i).hasChildNodes) // add toogle in
{
if(nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
}
else
{
if (nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + nodes.childNodes(i).nodeName + "</A>");
}
else
{
document.writeln(nodes.childNodes(i).nodeName);
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
document.writeln("</DIV>");
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
function writechildren(sianz)
{
if (sianz.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < sianz.childNodes.length; i++) // check the length of the childNOdes
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (sianz.childNodes(i).hasChildNodes) // add toogle in
{
if (sianz.childNodes(i).nodeName == "#text")
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}

}
}
else
{
if(sianz.childNodes(i).nodeName == "#text")
{
HERE if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + sianz.childNodes(i).text + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).text);
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy" + ">" + sianz.childNodes(i).nodeName + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).nodeName);
writechildren(sianz.childNodes(i))
}
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
}
}

function toogle_state(nodeCounter) // this toogle the state and pass info to the sideView.html side
{
var location = nodeCounter.sourceIndex // locate the location of the nodeCounter
var locationIMG = document.all[location + 1] //this locate the IMG tag for this
var nextDivLocation = document.all[location+2] // location the DIV
if (nextDivLocation.style.display =="")
{
nextDivLocation.style.display = "none"
locationIMG.src = "plus.gif";
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
//var stFrame = parent.frames['sidethingy']; // pass data to the other frame
//stFrame.controlText(nextDivLocation.innerText);
}
}
function callReadXml()
{
root = xmlDoc.documentElement;
TestChildren(root);
}
</script>
</head>
<body>
<script type="text/javascript">
callReadXml();
</script>
</body>
</html>

glenngv
06-22-2004, 09:44 AM
sry for the double post, forget to add in the "HERE"

FYI, you can edit your post by clicking the Edit button.

It's also better that you put your codes in between
tags so that they are more readable. You can also highlight the word HERE so that it's easier to find. That way, more people will be inclined to help you.

Just a suggestion...:)

guowei1000
06-22-2004, 09:48 AM
ok! let me try again.... lets go!
I keep having problem with this code as it keep saying it doest not support the method around line 97 that i had highLight, hope someone can help Thanks



<html>
<head>
<script type="text/javascript">
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("note.xml");
function TestChildren(nodes) // write the first layer out
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
document.writeln("<A onClick='javaScript:toogle_state(this)'><font color= red><IMG SRC='minus.gif'>"+ nodes.nodeName +"</font></A>");
if (nodes.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < nodes.childNodes.length; i++)
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (nodes.childNodes(i).hasChildNodes) // add toogle in
{
if(nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+nodes.childNodes(i).nodeName +"</A></font>");
writechildren(nodes.childNodes(i))
}
}
else
{
if (nodes.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + nodes.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + nodes.childNodes(i).nodeName + "</A>");
}
else
{
document.writeln(nodes.childNodes(i).nodeName);
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
document.writeln("</DIV>");
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
function writechildren(sianz)
{
if (sianz.hasChildNodes)
{
document.writeln("<DIV>");
for (var i=0; i < sianz.childNodes.length; i++) // check the length of the childNOdes
{
document.writeln("<table border = 1>");
document.writeln("<tr>");
document.writeln("<td>");
if (sianz.childNodes(i).hasChildNodes) // add toogle in
{
if (sianz.childNodes(i).nodeName == "#text")
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'>"+ sianz.childNodes(i).text + "</A></font>");
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'" + "href = " + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target = 'sidethingy'" +"><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln("<font color= red><A onClick='javascript:toogle_state(this)'><IMG SRC='minus.gif'> "+ sianz.childNodes(i).nodeName + "</A></font>");
writechildren(sianz.childNodes(i))
}

}
}
else
{
if(sianz.childNodes(i).nodeName == "#text")
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy"+ ">" + sianz.childNodes(i).text + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).text);
writechildren(sianz.childNodes(i))
}
}
else
{
if(sianz.childNodes(i).getAttribute("url"))
{
document.writeln("<A href=" + sianz.childNodes(i).getAttribute("url") + " &nbps " + "target=sidethingy" + ">" + sianz.childNodes(i).nodeName + "</A>");
writechildren(sianz.childNodes(i))
}
else
{
document.writeln(sianz.childNodes(i).nodeName);
writechildren(sianz.childNodes(i))
}
}
}
document.writeln("</td>");
document.writeln("</tr>");
document.writeln("</table>");
}
}
}

function toogle_state(nodeCounter) // this toogle the state and pass info to the sideView.html side
{
var location = nodeCounter.sourceIndex // locate the location of the nodeCounter
var locationIMG = document.all[location + 1] //this locate the IMG tag for this
var nextDivLocation = document.all[location+2] // location the DIV
if (nextDivLocation.style.display =="")
{
nextDivLocation.style.display = "none"
locationIMG.src = "plus.gif";
}
else
{
nextDivLocation.style.display = ""
locationIMG.src = "minus.gif";
//var stFrame = parent.frames['sidethingy']; // pass data to the other frame
//stFrame.controlText(nextDivLocation.innerText);
}
}
function callReadXml()
{
root = xmlDoc.documentElement;
TestChildren(root);
}
</script>
</head>
<body>
<script type="text/javascript">
callReadXml();
</script>
</body>
</html>

glenngv
06-22-2004, 10:12 AM
Text nodes (#text) represent the text of an element or attribute, so they don't have attributes and cannot have children.

guowei1000
06-22-2004, 10:14 AM
:O i din know that! Thanks alot!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum