Code:
function loadXML()
{
var xmlDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
xmlDoc.async="false";
// If the XML document has been completely loaded then proceed
if (xmlDoc.readyState==4)
{
xmlDoc.loadXML(document.form_dummy.optionXML.value);
document.form_dummy.optionXML.disabled=true;
var optNo = parseInt(document.form.optionNumber.value);
var iNoOfOpts = parseInt(document.form.iNoOfOpt.value);
// If the XML document has got options
if (xmlDoc.documentElement.hasChildNodes)
{
var oNode = xmlDoc.documentElement.selectNodes("PiccoOption");
// Loop through all the options that have been returned from the database
for(var i=0; i<iNoOfOpts; i++)
{
// if the current option is not the option that was selected
// then go ahead and delete it from the document
if (i!=optNo)
{
xmlDoc.firstChild.removeChild(oNode.item(i));
}
}
}
document.form.optionXML_rev.value=(xmlDoc.xml); // Write the XML to the form field text box to be submitted through to NF2
}
}
I have created this loadXML function. Can someone tell me if using var xmlDoc = new ActiveXObject("MSXML2.DOMDocument.3.0"); is the best way to refer to it in JavaScript, should it be MSXML.Document or something else?
IE Only Code.
Picco
www.crmpicco.co.uk
www.ie7.com