-- 作者:qanyy
-- 发布时间:10/16/2004 9:05:00 PM
-- HTML中的XML数据岛的瀏覽
cd.xml的內容如下: <?xml version="1.0" encoding="Big5"?> <CATALOG> <CD> <TITLE>Empire Burlesque</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>Hide your heart</TITLE> <ARTIST>Bonnie Tylor</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>Greatest Hits</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> <CD> <TITLE>Still got the blues</TITLE> <ARTIST>Gary More</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>Virgin redords</COMPANY> <PRICE>10.20</PRICE> <YEAR>1990</YEAR> </CD> <CD> <TITLE>Eros</TITLE> <ARTIST>Eros Ramazzotti</ARTIST> <COUNTRY>EU</COUNTRY> <COMPANY>BMG</COMPANY> <PRICE>9.90</PRICE> <YEAR>1997</YEAR> </CD> </CATALOG> cd.htm的內容如下: <?xml version="1.0" encoding="Big5"?> <html> <head> <script for="window" event="onload"> xmldso.XMLDocument.load("cd.xml"); </script> <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> <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="上一張CD" onclick="moveprevious()"></input> <input type="button" value="下一張CD" onclick="movenext()"></input> </p> </body> </html> 注意把encoding="Big5"改為encoding="gb2312"
|