In the first example, the element displayed the first entry of the data file. When you add another entry to the file, the data file (data1.txt) looks like this:
<OBJECT ID="data2" CLASSID="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
<PARAM NAME="DataURL" VALUE="data2.txt">
<PARAM NAME="UseHeader" VALUE="TRUE">
<PARAM NAME="TextQualifier" VALUE="~">
<PARAM NAME="FieldDelim" VALUE="|">
/* Get the complete data record set */
/* Go to next data */
<SPAN DATASRC="#data1" DATAFLD="name"></SPAN>
<SPAN DATASRC="#data1" DATAFLD="age"></SPAN>
The output will be:
Initially, the entire data is stored in a variable dataset using the recordset method. The moveNext() method points to the next data item (next row). Other methods that can be used are:
- moveFirst(): Points to the first data item (first row).
- moveLast(): Points to the last data item (last row).
- EOF: Checks to see if you have reached the end of the file.
It might be beneficial to see this control in a more dynamic example. Listing 3
Though this functionality is only availble in MSIE, it is extemely versatileespecially when you've got small amounts of character-delimited data that you want to extract and display using client-side scripting.