Web設(shè)計(jì)中如何使用XML數(shù)據(jù)3
發(fā)表時(shí)間:2024-02-12 來(lái)源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]現(xiàn)在,研究一下下面的HTML頁(yè)面: 。!-- example3.htm --> 。糷tml> 。糷ead> 。紅itle>XML DSO-example3.htm</title> 。約cript language="JavaScript"> function lo...
現(xiàn)在,研究一下下面的HTML頁(yè)面:
。!-- example3.htm -->
。糷tml>
。糷ead>
<title>XML DSO-example3.htm</title>
。約cript language="JavaScript">
function load() {
var xmlDso=myXML.XMLDocument;
xmlDso.load("example3.xml");
}
。/script>
。/head>
。糱ody bgcolor="#FFFFFF" onLoad="load()">
<o(jì)bject id="myXML" CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39"
width="0" height="0"></object>
。紅able datasrc="#myXML" border="1">
。紅head>
<th>Message</th>
。紅h>URL</th>
</thead>
。紅r>
。紅d><div datafld="message"></div></td>
<td><div datafld="URL"></div></td>
。/tr>
。/table>
</body>
</html>
輸出應(yīng)是:
Message URL
JavaScript Ticker using XML DSO http://someURL.com
上面的腳本非常特殊化。下面給出一個(gè)更一般的腳本:
<script language="JavaScript">
var xmlDso;
function load(xmlFile, objName) {
eval(''xmlDso=''+objName+''.XMLDocument'');
xmlDso.load(xmlFile);
}
。/script>
Now, to load any XML file use:
load("SomeXMLFile.xml","anyXmlDsoObject");(csdn)