[Javascript] Retaining values
Troy III Ajnej
trojani2000 at hotmail.com
Wed Apr 13 18:45:53 CDT 2011
> Example [1] Uses .innerHTML, which seems to be a practice that even
> you say you shouldn't do.
It's not a practice It's an HTML standard. And please don't use it
cause people are saying bad things about it. They might also say:
"don't read documentations and specifications - just take my word
for it."
> Additionally, the example given fails IF the "to be inserted content"
> is enclosed within another <div>
>
> For example:
>
> <body onload="addElement()">
> <div id='org_div1'>
> The text above has been created dynamically.
> </div>
> </body>
>
> Will work -- see here:
> http://www.webbytedd.com/aa/dom-script/index1.php
>
And it of course should.
> Whereas:
>
> <body onload="addElement()">
> <div id='page'>
> <div id='org_div1'>
> The text above has been created dynamically.
> </div>
> </div>
> </body>
>
> will fail -- see here: http://www.webbytedd.com/aa/dom-script
Exactly. I would get very confused If it didn't!
> Why?
>
If you are (for some unknown reason) suspecting...; well,
it isn't because you are using innerHTML - guaranteed.
"A child of your child is not your child" they say.
That's why.
Somebody mentioned "pitfalls" I guess this is the time and
the place, to exactly reveal: where do they reside and to
whom they exactly belong...
The answer to that, is pretty apparent.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Troy III
progressive art enterprise
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
More information about the Javascript
mailing list