anirban.anirbanju@gmail.com wrote :[color=blue]
> hi there,[/color]
[color=blue]
> my script is:
> ---------------------------------------------------------------------------------------------------------------------
>
> function addRow()
> {
> alert("called addRow");
> var totalRow = document.all.colordef_tab.rows.length;[/color]
Your code is IE-specific here.
Accessing Elements with the W3C DOM
http://www.mozilla.org/docs/web-deve...tml#dom_access
"You should not use the two proprietary DOMs, Netscape's document.layers
or Microsoft's document.all, any more, though. Safari doesn't support
these DOMs, and neither does Mozilla. Use the Document.getElementById
DOM instead."
Web Page Development: Best Practices
http://developer.apple.com/internet/...estwebdev.html
Javascript Best Practices
Don't Use document.all
http://www.javascripttoolbox.com/bestpractices/
[color=blue]
> alert("total row:"+totalRow);
>
> var row = document.all.colordef_tab.insertRow();
> var cell_1 = row.insertCell();
> var cell_2 = row.insertCell();
> var cell_3 = row.insertCell();
> var cell_4 = row.insertCell();
> var cell_5 = row.insertCell();
>
> cell_1.innerHTML = '<input type="checkbox" name="deleteflag"
> id="deleteflag" value="">'+
> '<input type="hidden" name="frm_colordefid"
> value="">';[/color]
Just like another poster said, if your addRow() function is called more
than once (and it should be called more than once according to you),
then several form controls will have the same id ... which is wrong from
a markup perspective and from a DHTML/javascript perspective.
[color=blue]
> cell_2.innerHTML = '<input type="text" align="left"
> name="frm_fromvalue" value="">';
> cell_3.innerHTML = '<input type="text" align="left"
> name="frm_tovalue" value="">';
> cell_4.innerHTML = '<input type="text" name="frm_colortext"
> id="result_ids" value="" readonly >'+
> '<input id="button_id" type=button
> onClick="ColorChooser(\'button_id\', \'result_ids\',\'value\')"
> value="color">';
> cell_5.innerHTML = '<input type="text" align="left"
> name="frm_colorvalue" id="dest_id" value="" readonly>';
>
> }
>
> and my jsp is:
> -------------------------------------------------------------------------------------------------------
>
> <table width="100%" id="colordef_tab" border="1">
>[/color]
By specifying width="100%", you are constraining the table. This is
important to understand in particular if later your table has layout issues.
[color=blue]
> <tr class="list">
> <td width="5%" align="left" class="style7"
> scope="col">Delete</td>[/color]
If that row is a table column header, then you should use <th> instead.
In any case, the default horizontal alignment of <td> (left) and <th>
(center) makes it unneeded to specify the alignment in all modern browsers.
Gérard
--
remove blah to email me