系列之十五:xml的运用(二)
还是接着上面的那个例子,这个例子来显示
如何在那些记录之间进行移动。
cd_navigate.htm文件:
<html>
<head>
<script language="&#106avascript">
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=http://www.1fanwen.com/#xmldso datafld="title"></span></td></tr>
<tr><td>artist:</td><td><span id="artist" datasrc=http://www.1fanwen.com/#xmldso datafld="artist"></span></td></tr>
<tr><td>year:</td><td><span id="year" datasrc=http://www.1fanwen.com/#xmldso datafld="year"></span></td></tr>
<tr><td>country:</td><td><span id="country" datasrc=http://www.1fanwen.com/#xmldso datafld="country"></span></td></tr>
<tr><td>company:</td><td><span id="company" datasrc=http://www.1fanwen.com/#xmldso datafld="company"></span></td></tr>
<tr><td>price:</td><td><span id="price" datasrc=http://www.1fanwen.com/#xmldso datafld="price"></span></td></tr>
</table>
<p>
<input type=button &#118alue="previous cd" &#111nclick="moveprevious()">
<input type=button &#118alue="next cd" &#111nclick="movenext()">
</p>
</body>
</html>
翻译:batman
系列之十六:xml的运用(三)
一个稍微复杂点的运用,还是使用的第一个运用中的xml数据文件
注意当你现在使用鼠标点击表格中的第一个字段时,
在上面的数据会相应地改变title的内容。(当然你可以对它相应的改改
它就可以显示其他字段的内容了。)
cd_application.htm文件:
<html>
<head>
<script language="&#106avascript">
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=http://www.1fanwen.com/#xmldso datafld="title"></span></td></tr>
<tr><td>artist:</td><td><span id="artist" datasrc=http://www.1fanwen.com/#xmldso datafld="artist"></span></td></tr>
<tr><td>year:</td><td><span id="year" datasrc=http://www.1fanwen.com/#xmldso datafld="year"></span></td></tr>
<tr><td>country:</td><td><span id="country" datasrc=http://www.1fanwen.com/#xmldso datafld="country"></span></td></tr>
<tr><td>company:</td><td><span id="company" datasrc=http://www.1fanwen.com/#xmldso datafld="company"></span></td></tr>
<tr><td>price:</td><td><span id="price" datasrc=http://www.1fanwen.com/#xmldso datafld="price"></span></td></tr>
</table>
<p>
<input type=button &#118alue="previous cd" &#111nclick="moveprevious()">
<input type=button &#118alue="next cd" &#111nclick="movenext()">
</p>
</body>
</html>