使用javascript和msxml的简单xml编辑器

时间:2012-01-24 08:36:29

标签: javascript xml

是否有这种实施的例子? 如何在编辑或文本控件中加载/保存msxml的上下文?

<html><head>
<script language="JavaScript">
function loadxml()
{
  var fileName = document.getElementById("fileName");

  var xmlData = new ActiveXObject("Msxml2.DOMDocument");
  xmlData.load(fileName.value);

  var editor = document.getElementById("editor");
  editor.value = xmlData; // got [object]
}
function testxml()
{
  var editor = document.getElementById("editor");
  // editor.value load by msxml
}
</script>
</head>
<body>
<input type="file" id="fileName"/>
<input type="button" value="Load" onclick="loadxml();"/>
<input type="button" value="Test" onclick="testxml();"/><br>
<textarea id="editor" rows="25" cols="50">no data</textarea>
</body>
</html>

0 个答案:

没有答案