Alright this runs just fine in IE but in firefox I get nothing
thanks for your time.
Code:
function startup() { if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } else if (document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } if (xmlDoc!=null) { xmlDoc.async=false; xmlDoc.load("XML/faq.xml"); var x=xmlDoc.getElementsByTagName("QUES"); for (i=0;i<x.length;i++) { t = x[i].getElementsByTagName("CAT")[0].childNodes[0].nodeValue; categories.push(t); } var categoryList = categories.unique(); for (var i=categoryList.length-1; i>=0; --i ) { selectCategory.options[i]=new Option(categoryList[i], i, true, false); } sizeOfCats = selectCategory.options.length; selectCategory.options[sizeOfCats]=new Option("Select", sizeOfCats, true, true); } } Array.prototype.unique = function() { var r = new Array(); o:for(var i = 0, n = this.length; i < n; i++) { for(var x = 0, y = r.length; x < y; x++) { if(r[x]==this[i]) { continue o; } } r[r.length] = this[i]; } return r; } function clearSelect() { selectQuestion.options.length = 0; } function loadSelectQuestion() { questions = []; theAnswer.innerHTML=""; var theCategory = selectCategory.options[selectCategory.selectedIndex].text; if(theCategory != "Select") { divSelectQuestion.innerHTML = "<p>Select a Question:</p><select id=\"selectQuestion\" onchange=\"loadAnswer()\"></select><br/><br/>"; var x=xmlDoc.getElementsByTagName("QUES"); for (i=0;i<x.length;i++) { aCategory = x[i].getElementsByTagName("CAT")[0].childNodes[0].nodeValue; if(aCategory == theCategory) { aQuestion = x[i].getElementsByTagName("Q")[0].childNodes[0].nodeValue; questions.push(aQuestion); for (var j=questions.length-1; j>=0; --j ) { selectQuestion.options[j]=new Option(questions[j], j, true, false) } } else { } } sizeOfQues = selectQuestion.options.length; selectQuestion.options[sizeOfQues]=new Option("Select", sizeOfQues, true, true); } else { divSelectQuestion.innerHTML = ""; } } function loadAnswer() { var theQuestion = selectQuestion.options[selectQuestion.selectedIndex].text; var x=xmlDoc.getElementsByTagName("QUES"); for (i=0;i<x.length;i++) { aQuestion = x[i].getElementsByTagName("Q")[0].childNodes[0].nodeValue; if(aQuestion == theQuestion) { anAnswer = x[i].getElementsByTagName("A")[0].childNodes[0].nodeValue; theAnswer.innerHTML = "Answer:<br/><br/>" + anAnswer + "<br/><br/>"; } } } </script>
Comment