Re: Refer to dynamically generated objects during page load



Sisilla wrote:
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.
[...]

Please trim your quotes, and don't quote signatures unless you are referring
to them. TIA.

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?

No, it is conceivable. I am doing that myself.

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.

Good luck.

However, I am still not convinced that using `innerHTML' (which is a
proprietary property, BTW) is even necessary here. If you change the
content of the document when it is just loaded anyway, why could the
server not generate the proper markup (with all options properly
selected) in the first place?


PointedEars
.



Relevant Pages

  • Re: Refer to dynamically generated objects during page load
    ... to generate some multiple selection dropdowns. ... and assign the serialization of the document tree to `innerHTML'. ... listbox B where the contents of this listbox is chosen according to a selection in listbox A. ...
    (comp.lang.javascript)
  • Re: method to avoid the "screen-flicker-refresh" of postbacks?
    ... i have a section of a page that has multiple dropdowns. ... each dropdown calls the same method on a change of selection by the ... the method loops over all the dropdowns and if the newly ... screen to refresh and display the page at the top (same position as ...
    (microsoft.public.dotnet.framework.aspnet)
  • method to avoid the "screen-flicker-refresh" of postbacks?
    ... i have a section of a page that has multiple dropdowns. ... each dropdown calls the same method on a change of selection by the ... screen to refresh and display the page at the top (same position as ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: DDLB user control.. wherre to put code..
    ... As I explained, the dropdowns are in a usercontrol, not the main page.. ... > retrieve the updated selection item. ... maybe I can find some workaround for you. ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Refer to dynamically generated objects during page load
    ... to generate some multiple selection dropdowns. ... I would like to manipulate the dropdowns by calling ... some javascript functions. ...
    (comp.lang.javascript)