tags:

views:

72

answers:

1

I'm having trouble finding information online for creating a object in javascript and pointing it to a id in the html.

Here's what I have so far for the JavaScript:

 function countRecords()
 { 
 headRow=new Object();
 //point to specific id here?
 var rowCount = 0;

The HTML:

<table id="prodTable">
 <tr><th colspan="8">Digital Cameras</th></tr>
 <tr id="titleRow">
  <th>Model</th>
  <th>Manufacturer</th>
  <th>Resolution</th>
  <th>Zoom</th>
  <th>Media</th>
  <th>Video</th>
  <th>Microphone</th>
 </tr>
A: 

when the book says "create an object" what it really means is "declare a variable headRow" and then get a reference to the document object with the id "titleRow".

so,

var headRow; // create the "object" 
headRow = document.GetElementById('titleRow'); // point to the table row "titleRow"
lincolnk
wished they would have worded it that way. Thanks!
Matt
Please remember that JavaScript is case sensitive. `document.GetElementById` is not a function, but `document.getElementById` is
Justin Johnson
i knew there was something that looked funny about that. spaced out today :p
lincolnk