Take a look at the use of innerHTML here and see if you're writing to
read-only property:
http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/inn
erht
ml.asp
On the other hand, I think you could simplify your code a lot:
1) I see that you have one DIV containing immediately another DIV.
Remove
of them if possible.
2) To make your code easier to read, it is not always necessary to
delimit
attribute values with quotes, providing they satisfy some conditions.
Look
at 4th paragraph of this:
http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2
3) </tr> and </td> are optional. Remove them to make your string
shorter.
Have your tried to print the string in an alert box to debug?
> -----Message d'origine-----
> De : Ranganaathan.V.V [mailto:ranganvv@y...]
> Envoy=C3=A9 : samedi 23 novembre 2002 08:23
> =C3=80 : javascript
> Objet : [javascript] Re: to remove a row using JavaScript
>
>
> Hi Solker,
> Thx for ur mail. The reason for using <Div> tag is, I have an
> ASP screen
> which contains a multi record block, each record is treated
> as a row. I
> build each row dynamically when i fetch rows from the
> Database and if i
> want to add new rows to the existing set from an pop up
> window. Since i
> have to paint rows at run time i'm using this <DIV> tag.
> The problem i encounter is, i'm able to delete a row successfully and
> remove the <DIV> contents and the <DIV> itself using the syntax :
>
> document.all(a).innerText=3D'' && document.all(a).outerText=3D''
>
> (where "all" is the <Div> name and "a" is the row id)
>
> After this, if i want to add a new row, i'm not able to do
> it. The syntax
> i use here is
>
> document.all(counter).innerHTML=3Dstr;
> (where counter is the row index )
>
> str is the variable where i build the <Div> like this ::
>
> var str=3D"<div id=3D'"+divcounter+"'><div
id=3D'"+divcounter1+"'><table
> border=3D2 bgcolor=3Dyellow><tr><td><div
> id=3D'"+snodiv+"'>"+counterstr+"</div></td><td><input type=3Dtext
> name=3D'"+textcounter+"' value=3D'"+textval+"'></td><td
width=3D'60'><div
> id=3D'"+morecounter+"'><input type=3Dbutton name=3D'more'
value=3D'MORE'
> onClick=3D'adder1(\""+divcounter+"\")'></div></td><td><input
> type=3D'button'
> name=3D'remove' value=3D'REMOVE' onclick=3D'rem
> (\""+divcounter1+"\")'></td></tr></table></div></div>";
>
>
> (it contains a Serial No, text box, a more button to add a row and a
> remove button to remove a row)
>
> Hope i'm clear now, i will also make use the URL sites u have
> mentioned,
> do let me know if u could throw some light on this.
>
> Thx for ur time and mail.
>
> Rgds
> Rangan
>