Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

adjacentHTML property

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
I am currently using the innerHTML property of a DIV to add rows to a table dynamically. However, as a lot of rows are added, the script starts to get very slow. This is because each row in the table contains 14 input fields. Each time a row is added the complete table is regenerated. This means that every time a row is added, the contents od every input field must be retrieved for output in the new table (with the additional empty row).

I have seen an 'adjacentHTML' property somewhere and what I would like to know is can I use this to add a row to the table without having to regenerate the table rows that are currentlty there. Bear in mind that this table is enclosed in a form and all the newly generated rows must be able to be submitted.

Can I do something like:

<FORM>
<TABLE>
<DIV ID=&quot;myDIV&quot;>
<TR><TD>........</TD></TR>
.
.
</DIV>
</TABLE>
submit buttons here...
</FORM>
<a href='' onClick=&quot;myDiv.adjacentHTML='<TR><TD>....</TD></TR>'&quot;>Add Row</A>

Is it possible to do something like this????? Mise Le Meas,

Mighty :)
 
The adjacentHTML property acts in the same way as innerHTML. I'm not entirely sure, but I think it only works in Netscape 6.
 
Although it's syntax is a bit different. It looks like this:

Code:
document.getElementById(&quot;mylayer&quot;).adjacentHTML(&quot;text/html goes here&quot;);
 
hiee

it works in IE4+ as well;
& there is something else in syntax:

document.getElementById(&quot;mylayer&quot;).adjacentHTML(whereTo,&quot;text/html goes here&quot;);

where
whereTo={BeforeBegin,AfterBegin,BeforeEnd,AfterEnd}

2 add row 2 existin table u shuld insert into <table> instead of <div> (i think so, but may be i'm wrong)

regards, vic
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top