652 Part III . Document Objects Reference The (Web hosting billing)

652 Part III . Document Objects Reference The act of inserting a row into a table is not complete until you also insert cells into the row. The insertCell() method does just that, with a parameter indicating the zero-based index of the cell s position among other cells in the row. A value of 1 appends the cell to the end of existing cells in the row. When you invoke the insertCell() method, it returns a reference to the new cell. This gives you the opportunity to adjust other properties of that cell before moving onto the next cell. For example, if you want to insert a cell that has a col umn span of 2, you adjust the colSpanproperty of the cell whose reference just returned, as in the following: var oneCell = tableRowRef.insertCell(-1) oneCell.colSpan = 2 Scripts that add rows and cells must make sure that they add the identical num ber of cells (or cell column spaces) from one row to the next. Otherwise, you have an unbalanced table with ugly blank spaces where you probably don t want them. To remove a cell from a row, use the deleteCell() method. The parameter is a zero-based index value of the cell you want to remove. If all you want to do is replace the content of a cell, apply the new content to the innerHTML property of the TD element. This is smoother and safer than deleting and reinserting a cell because any execution error that occurs in the process results in an unbalanced table. Finally, to rid yourself of all cells in a row, use the deleteRow()method of the TABLE and table row section element objects. Example See Listing 27-2 for an example of inserting cells during the row insertion process. Related Item: TABLE.insertRow() method. TD and TH Element Objects For HTML element properties, methods, and event handlers, see Chapter 15. Properties Methods Event Handlers abbr align axis background bgColor borderColor borderColorDark borderColorLight cellIndex ch TD
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply