先有一个XML数据:
- xml version="1.0" ?>
- <Order>
- <Account>9900234Account>
- <Item id="1">
- <SKU>1234SKU>
- <PricePer>5.95PricePer>
- <Quantity>100Quantity>
- <Subtotal>595.00Subtotal>
- <Description>Super Widget ClampDescription>
- Item>
- <Item id="2">
- <SKU>6234SKU>
- <PricePer>22.00PricePer>
- <Quantity>10Quantity>
- <Subtotal>220.00Subtotal>
- <Description>Mighty Foobar FlangeDescription>
- Item>
- <Item id="3">
- <SKU>9982SKU>
- <PricePer>2.50PricePer>
- <Quantity>1000Quantity>
- <Subtotal>2500.00Subtotal>
- <Description>Deluxe DoohickieDescription>
- Item>
- <Item id="4">
- <SKU>3256SKU>
- <PricePer>389.00PricePer>
- <Quantity>1Quantity>
- <Subtotal>389.00Subtotal>
- <Description>Muckalucket BucketDescription>
- Item>
- <NumberItems>1111NumberItems>
- <Total>3704.00Total>
- <OrderDate>07/07/2002OrderDate>
- <OrderNumber>8876OrderNumber>
- Order>
9900234
-
1234
5.95
100
595.00
Super Widget Clamp
-
6234
22.00
10
220.00
Mighty Foobar Flange
-
9982
2.50
1000
2500.00
Deluxe Doohickie
-
3256
389.00
1
389.00
Muckalucket Bucket
1111
3704.00
07/07/2002
8876
然后把Item结点的数据读出。
相关的JS函数如下:
下面是测试网页代码:
- <body onload="getDataNext()">
- <form>
- <table border="0">
- <tr>
- <td>SKUtd>
- <td><input type="text" name="SKU">td>
- tr>
- <tr>
- <td>Pricetd>
- <td><input type="text" name="Price">td>
- tr>
- <tr>
- <td>Quantitytd>
- <td><input type="text" name="Quantity">td>
- tr>
- <tr>
- <td>Totaltd>
- <td><input type="text" name="Total">td>
- tr>
- <tr>
- <td>Descriptiontd>
- <td><input type="text" name="Description">td>
- tr>
- table>
- <input type="button" value="<<" onClick="getDataPrev()">
- <input type="button" value=">>" onClick="getDataNext()">
- form>
- body>
阅读(6423) | 评论(0) | 转发(0) |