J
Joe Bloggs
Hi,
I have an xml data island which is used for providing data for a
dropdown list. However, change the 'src' attribute of the xml data
island doesn't seem to reload the xml island properly....
Here is my code:
<html>
<head>
</head>
<body>
<script language="javascript">
function getNoneTextNode(node)
{
if(node.hasChildNodes && node.firstChild.nodeType!=3)
{
return node.firstChild;
}
else if(node.hasChildNodes && node.childNodes[1].nodeType==1)
{
return node.childNodes[1];
}
else if(node.hasChildNodes && node.firstChild.nodeType==1)
{
return node.firstChild;
}
return null;
}
function SelectData(control)
{
var xmlDoc = document.getElementById("xmlDoc");
xmlDoc.setAttribute("src", "DynamicXmlIsland.asp?Fetch=" +
(control.selectedIndex+1));
xmlDoc.load(xmlDoc.src);
alert (" I am here");
//get the root node
///var parentNode = xmlDoc.firstChild;
var parentNode = getNoneTextNode(xmlDoc);
var dropdown = document.getElementById("employeeDropdown");
for (var i = dropdown.length;i > 0;i--) {
dropdown.options[0] = null;
}
if (parentNode.hasChildNodes)
{
for(var i =0; i <parentNode.childNodes.length; i++)
{
var oOption = document.createElement("OPTION");
var optionValue =
document.createTextNode(parentNode.childNodes.childNodes[0].nodeValue);
oOption.appendChild(optionValue);
dropdown.appendChild(oOption);
}
}
}
</script>
<xml id="xmlDoc" src="DynamicXmlIsland.asp?Fetch=1"/>
Select 1 data file:
<select ONCHANGE="return SelectData(this)" id="Select1"
name="Select1" >
<option selected>1</option>
<option>2</option>
</select>
<br>
Employee Name:
<select id="employeeDropdown">
</select>
</body>
</html>
See the line where I have got the alert on.... if I comment that line
out, it doesn't work, but if I have the alert turned on, the xml
island is refreshed correctly....
I am really puzzled!!!!
Thanks in advanced
I have an xml data island which is used for providing data for a
dropdown list. However, change the 'src' attribute of the xml data
island doesn't seem to reload the xml island properly....
Here is my code:
<html>
<head>
</head>
<body>
<script language="javascript">
function getNoneTextNode(node)
{
if(node.hasChildNodes && node.firstChild.nodeType!=3)
{
return node.firstChild;
}
else if(node.hasChildNodes && node.childNodes[1].nodeType==1)
{
return node.childNodes[1];
}
else if(node.hasChildNodes && node.firstChild.nodeType==1)
{
return node.firstChild;
}
return null;
}
function SelectData(control)
{
var xmlDoc = document.getElementById("xmlDoc");
xmlDoc.setAttribute("src", "DynamicXmlIsland.asp?Fetch=" +
(control.selectedIndex+1));
xmlDoc.load(xmlDoc.src);
alert (" I am here");
//get the root node
///var parentNode = xmlDoc.firstChild;
var parentNode = getNoneTextNode(xmlDoc);
var dropdown = document.getElementById("employeeDropdown");
for (var i = dropdown.length;i > 0;i--) {
dropdown.options[0] = null;
}
if (parentNode.hasChildNodes)
{
for(var i =0; i <parentNode.childNodes.length; i++)
{
var oOption = document.createElement("OPTION");
var optionValue =
document.createTextNode(parentNode.childNodes.childNodes[0].nodeValue);
oOption.appendChild(optionValue);
dropdown.appendChild(oOption);
}
}
}
</script>
<xml id="xmlDoc" src="DynamicXmlIsland.asp?Fetch=1"/>
Select 1 data file:
<select ONCHANGE="return SelectData(this)" id="Select1"
name="Select1" >
<option selected>1</option>
<option>2</option>
</select>
<br>
Employee Name:
<select id="employeeDropdown">
</select>
</body>
</html>
See the line where I have got the alert on.... if I comment that line
out, it doesn't work, but if I have the alert turned on, the xml
island is refreshed correctly....
I am really puzzled!!!!
Thanks in advanced