明輝手游網(wǎng)中心:是一個免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺!

XML說明系列(8)

[摘要]系列之十五:XML的運(yùn)用(二)還是接著上面的那個例子,這個例子來顯示如何在那些記錄之間進(jìn)行移動。cd_navigate.htm文件:<html><head><script language="JavaScript">function move...
系列之十五:XML的運(yùn)用(二)
還是接著上面的那個例子,這個例子來顯示
如何在那些記錄之間進(jìn)行移動。
cd_navigate.htm文件:
<html>
<head>

<script language="JavaScript">
function movenext()
{
if (xmldso.recordset.absoluteposition < xmldso.recordset.recordcount)
{
xmldso.recordset.movenext();
}
}
function moveprevious()
{
if (xmldso.recordset.absoluteposition > 1)
{
xmldso.recordset.moveprevious();
}
}
</script>

<script for="window" event="onload">
xmldso.XMLDocument.load("cd_catalog.xml");
</script>

<TITLE>CD Navigate</TITLE>
</head>

<body>
<p>
<object WIDTH="0" HEIGHT="0"
CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" ID="xmldso">
</object>

<table>
<tr><td>Title:</td><td><SPAN ID="title" DATASRC=#xmldso DATAFLD="TITLE"></SPAN></td></tr>
<tr><td>Artist:</td><td><SPAN ID="artist" DATASRC=#xmldso DATAFLD="ARTIST"></SPAN></td></tr>
<tr><td>Year:</td><td><SPAN ID="year" DATASRC=#xmldso DATAFLD="YEAR"></SPAN></td></tr>
<tr><td>Country:</td><td><SPAN ID="country" DATASRC=#xmldso DATAFLD="COUNTRY"></SPAN></td></tr>
<tr><td>Company:</td><td><SPAN ID="company" DATASRC=#xmldso DATAFLD="COMPANY"></SPAN></td></tr>
<tr><td>Price:</td><td><SPAN ID="price" DATASRC=#xmldso DATAFLD="PRICE"></SPAN></td></tr>
</table>

<p>
<INPUT TYPE=button VALUE="Previous CD" ONCLICK="moveprevious()">
<INPUT TYPE=button VALUE="Next CD" ONCLICK="movenext()">
</p>

</body>
</html>

翻譯:Batman
系列之十六:XML的運(yùn)用(三)
一個稍微復(fù)雜點(diǎn)的運(yùn)用,還是使用的第一個運(yùn)用中的XML數(shù)據(jù)文件
注意當(dāng)你現(xiàn)在使用鼠標(biāo)點(diǎn)擊表格中的第一個字段時,
在上面的數(shù)據(jù)會相應(yīng)地改變Title的內(nèi)容。(當(dāng)然你可以對它相應(yīng)的改改
它就可以顯示其他字段的內(nèi)容了。)
cd_application.htm文件:
<html>
<head>

<script language="JavaScript">
function movenext()
{
if (xmldso.recordset.absoluteposition < xmldso.recordset.recordcount)
{
xmldso.recordset.movenext();
}
}
function moveprevious()
{
if (xmldso.recordset.absoluteposition > 1)
{
xmldso.recordset.moveprevious();
}
}
</script>

<script for="window" event="onload">
xmldso.XMLDocument.load("cd_catalog.xml");
</script>

<TITLE>CD Navigate</TITLE>
</head>

<body>
<p>
<object WIDTH="0" HEIGHT="0"
CLASSID="clsid:550dda30-0541-11d2-9ca9-0060b0ec3d39" ID="xmldso">
</object>

<table>
<tr><td>Title:</td><td><SPAN ID="title" DATASRC=#xmldso DATAFLD="TITLE"></SPAN></td></tr>
<tr><td>Artist:</td><td><SPAN ID="artist" DATASRC=#xmldso DATAFLD="ARTIST"></SPAN></td></tr>
<tr><td>Year:</td><td><SPAN ID="year" DATASRC=#xmldso DATAFLD="YEAR"></SPAN></td></tr>
<tr><td>Country:</td><td><SPAN ID="country" DATASRC=#xmldso DATAFLD="COUNTRY"></SPAN></td></tr>
<tr><td>Company:</td><td><SPAN ID="company" DATASRC=#xmldso DATAFLD="COMPANY"></SPAN></td></tr>
<tr><td>Price:</td><td><SPAN ID="price" DATASRC=#xmldso DATAFLD="PRICE"></SPAN></td></tr>
</table>

<p>
<INPUT TYPE=button VALUE="Previous CD" ONCLICK="moveprevious()">
<INPUT TYPE=button VALUE="Next CD" ONCLICK="movenext()">
</p>

</body>
</html>





標(biāo)簽:XML介紹系列(8)