this is what i am trying..
---------------------
if doctorNodes is null when <doctor> has no <doctors>
here is scenario.
1. when it opens the page, the page empty text field for doctors.
2. when it select the medical field name, it displays doctors when <doctor> has no <doctors>. otherwise it has to display empty text filed for doctors.
----------------------
here is my org. code..
---------------
it gets doctor's name based on medicali and display it as select box.
but I want to add text filed if doctorNodes is null
for example,
if doctorNodes is null
{<input type="text" name="medicalfield" id="medicalfield" />}
else
{// make selectBox
selectBox.options.add(new Option(doctorNodes[j].getAttributeNode("doctor_name").nodeValue));
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
var xmlDoc=xmlHttp.responseXML.documentElement;
var selectBox = document.getElementById("medicalid");
for(var y=selectBox.options.length; y > 0; y--)
{
selectBox.remove(selectBox.options[y]);
}
var doctorNodes = xmlDoc.getElementsByTagName("doctors")[0].getElementsByTagName("doctor")
for (j=0;j<doctorNodes.length;j++)
{
selectBox.options.add(new Option(doctorNodes[j].getAttributeNode("doctor_name").nodeValue));
}
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.