Using the Data Binding record Number Property : Table « HTML « JavaScript DHTML






Using the Data Binding record Number Property

 

/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/
<HTML>
<HEAD>
<TITLE>Data Binding (recordNumber)</TITLE>
<STYLE TYPE="text/css">
.filmTitle {font-style:italic}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
// set recordset pointer to the record clicked on in the table.
function setRecNum(row) {
    document.oscars.recordset.AbsolutePosition = row.recordNumber
}
</SCRIPT>
</HEAD>
<BODY>
<P><B>Academy Awards 1978-1997</B> 
(Click on a table row to extract data from one record.)</P>
<P>The award for Best Actor of <SPAN DATASRC="#oscars" DATAFLD="Year"></SPAN>
&nbsp;went to <SPAN DATASRC="#oscars" DATAFLD="Best Actor"></SPAN>
&nbsp;for his outstanding achievement in the film 
<SPAN CLASS="filmTitle" DATASRC="#oscars" DATAFLD="Best Actor Film"></SPAN>.</P>
<TABLE BORDER=1 DATASRC="#oscars" ALIGN="center">
<THEAD STYLE="background-color:yellow; text-align:center">
<TR><TD>Year</TD>
    <TD>Film</TD>
    <TD>Director</TD>
    <TD>Actress</TD>
    <TD>Actor</TD>
</TR>
</THEAD>
<TR ID=repeatableRow onClick="setRecNum(this)">
    <TD><DIV ID="col1" DATAFLD="Year"></DIV></TD>
    <TD><DIV CLASS="filmTitle" ID="col2" DATAFLD="Best Picture"></DIV></TD>
    <TD><DIV ID="col3" DATAFLD="Best Director"></DIV></TD>
    <TD><DIV ID="col4" DATAFLD="Best Actress"></DIV></TD>
    <TD><DIV ID="col5" DATAFLD="Best Actor"></DIV></TD>
</TR>
</TABLE>
<OBJECT ID="oscars" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
    <PARAM NAME="DataURL" VALUE="Academy Awards.txt">
    <PARAM NAME="UseHeader" VALUE="True">
    <PARAM NAME="FieldDelim" VALUE="&#09;">
</OBJECT>
</BODY>
</HTML>



           
         
  








Related examples in the same category

1.Tabular data in Javascript with hyper link
2.Change the width of a table border
3.Change the cellPadding and cellSpacing of a table
4.Specify frames of a table
5.Change table row height
6.Specify rules for a table
7.Create table caption
8.Deleting table rows
9.Adding table rows
10.Align the cell content in a table row
11.Change the cell content in a table row
12.Vertical align the cell content in a table row
13.Align the cell content in a single cell
14.Vertical align the cell content in a single cell
15.Adding cells to a table row
16.Change the colspan of a table row
17.Insert table row: the uniqueID Property
18.Using the cloneNode Method
19.Cycling Through Table frame Property Values
20.Replacing Table Cell Content
21.Inserting/Removing Row Elements
22.Modifying Table Columns
23.Accessing userProfile Data
24.Cycling Through Table rows Property Values
25.Using the offsetParent Property
26.Transforming JavaScript Data into HTML Tables
27.Transforming JavaScript Data into HTML Tables with HyperLink
28.Create a table
29.Change table border width and cell padding