css in the chapter 6 folder (along with
the GIF image and JavaScript document, neither of which are
amended).
1. Link to the JavaScript document. Taking things up from the completed table from
the previous exercise (also available in the download files as styling-theplaylist-
table.html and styling-the-playlist-table.css), add a script element
in the HTML document??™s head section to link to the JavaScript file
styling-the-playlist-table.js. Note that the JavaScript document is also available
in the download files.
2. Give the table a unique id. For the script to do its work, the table start tag must
be given a unique id value. This must match the value given in styling-theplaylist-
table.js in the onload function. Therefore, add the id attribute and
value shown in the following code block:
In the JavaScript, the relevant code that matches this is already defined, as shown
in the following code block:
window.onload = function() {
zebraTable.stripe('playlist1');
}
Applying separator stripes
TABLES: HOW NATURE (AND THE W3C) INTENDED
251
6
3. Assign a separator stripe style. The script creates alternating table rows, which are
given a class value of alt. This can then be styled in CSS by using a rule with the
selector tbody tr.
Pages:
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349