<script type="text/javascript">
//建立xml
var doc = new ActiveXObject("Microsoft.XMLDOM");
//建立一個根節點,並添加到xml
var Root = doc.createElement("root");
doc.appendChild(Root);
var Row = doc.createElement("row");
Root.appendChild(Row);
//向根節點添加屬性,setAttribute(key , value);
Row.setAttribute("operation", "search");
alert(doc.xml);
</script>javascript