Re: Refer to dynamically generated objects during page load



On Sep 8, 11:52 am, Thomas 'PointedEars' Lahn <PointedE...@xxxxxx>
wrote:
Sisilla wrote:
I am using

[element].innerHTML=xmlHttp.responseText

to generate some multiple selection dropdowns. Before the page is
finished loading, I would like to manipulate the dropdowns by calling
some javascript functions. The trouble is that I cannot refer to the
dropdownobjects until after the page has loaded.

Is there any way to accomplish what I'm trying to do without
constructing the dropdowns with DOM document methods?

xmlHttp.responseXML yields an (I)XML(DOM)Document object reference, given a
response served with an XML media type. You can manipulate that document
with DOM methods (you have to, or it would have to be PITA-string-parsing),
and assign the serialization of the document tree to `innerHTML'. That
said, I don't think you need `innerHTML' anymore then.

And if you think about it, if the responseText value is the result of a
database query as you state in [1], the server should generate the
appropriate response in the first place, without you having to script
anything client-side.

PointedEars
___________
[1] <1189256144.770477.245...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300d...@xxxxxxxxxxxxxxxx>

FYI: Some multiple option select elements are getting their options
from the database, and based on another query, certain options will be
pre-selected. Is this scenario really that impossible to imagine?

Your reply has left me with an idea, however. I will try to execute
both queries before updating innerHTML, and try to assign "selected"
attributes to the appropriate options based on the second query. I'll
let you know how it turns out. Thanks.

.