15.02.2013 Views

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

JavaScript Examples Bible - UserWorks Technologies

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 1 ✦ Generic HTML Element Objects (Chapter 15)<br />

the AbsolutePosition property, which is the integer value of the current record<br />

that the data object points to (it can point to only one row at a time, and the default<br />

row is the first row). The statement sets the AbsolutePosition property of the<br />

recordset object to the recordNumber property for the row that the user clicks.<br />

Because the three SPAN elements are bound to the same data source, they are<br />

immediately updated to reflect the change to the data object’s internal pointer to<br />

the current record. Notice, too, that the third SPAN object is bound to one of the<br />

data source fields not shown in the table. You can reach any field of a record<br />

because the Data Source Object holds the entire data source content.<br />

Listing 15-15: Using the Data Binding recordNumber Property<br />

<br />

<br />

Data Binding (recordNumber)<br />

<br />

.filmTitle {font-style:italic}<br />

<br />

<br />

// set recordset pointer to the record clicked on in the table.<br />

function setRecNum(row) {<br />

document.oscars.recordset.AbsolutePosition = row.recordNumber<br />

}<br />

<br />

<br />

<br />

Academy Awards 1978-1997 (Click on a table row to extract data from<br />

one record.)<br />

The award for Best Actor of <br />

&nbsp;went to <br />

&nbsp;for his outstanding achievement in the film<br />

.<br />

<br />

<br />

Year<br />

Film<br />

Director<br />

Actress<br />

Actor<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

<br />

Continued<br />

41<br />

elementObject.recordNumber

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!