<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>ワードのXMLファイルを読み込む(共通)</title>
<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript"><!--
function loadXMLFile()
{
new Ajax.Request("sample.xml", { method: "get", onComplete: displayData });
}
function displayData(httpObj)
{
$("result").innerHTML = "";
var xmlObj = httpObj.responseXML;
if (window.createPopup) var textTag = "w:t"; else var textTag = "t";
var wtTag = xmlObj.getElementsByTagName(textTag);
for (var i=0; i<wtTag.length; i++)
{
var txt = wtTag[i].childNodes[0].nodeValue;
$("result").innerHTML += txt;
}
}
// --></script>
</head>
<body>
<h1>ワードのXMLファイルを読み込む(共通)</h1>
<form>
<input type="button" value="ファイルを読み込む" onClick="loadXMLFile()"><br>
</form>
<div id="result"></div>
</body>
</html>