做记录:
function createXML(e_id,q_id,q_type,q_grade,number,title,arr_item){
var xmlObj = new ActiveXObject("Microsoft.XMLDOM");
var p = xmlObj.createProcessingInstruction('xml', 'version="1.0" encoding="GBK"');
xmlObj.appendChild(p);
var EXAM = xmlObj.createElement("exam");
xmlObj.appendChild(EXAM);
EXAM.setAttribute("e_id",e_id);
var QUESTION = xmlObj.createElement("question");
QUESTION.setAttribute("q_id",q_id);
QUESTION.setAttribute("q_type",q_type);
QUESTION.setAttribute("q_grade",q_grade);
EXAM.appendChild(QUESTION);
var Q_TITLE = xmlObj.createElement("title");
Q_TITLE.appendChild(xmlObj.createTextNode(title));
QUESTION.appendChild(Q_TITLE);
for ( var i = 0; i < number; i++) {
var Q_ITEM = xmlObj.createElement("item");
Q_ITEM.appendChild(xmlObj.createTextNode(arr_item[i]));
QUESTION.appendChild(Q_ITEM);
}
alert(xmlObj.xml);
}