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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay, Status or onafterupdate off a Selectbox?

Status
Not open for further replies.

RayDance

Programmer
Mar 22, 2002
13
NL
Hi there I've a litle problem with reading the length of my Selectbox, after I load XML-nodes as options to it. Directly after loading the xml into my selectbox as options, I can't get the length off the selectbox. It seems that the Selectbox needs a little time or delay for refreshing the cliënts memory???

- This is what I Have:
<select id=&quot;Book&quot; name=&quot;Book&quot; SIZE=&quot;29&quot; style=&quot;width: 225px;&quot;></select>

- I am dynamicly filling it with Nodes from a xml-document within javascript:
<script>
bookItems.XMLDocument.async=true;
bookItems.ondataavailable = bookItemsLoaded;
bookItems.XMLDocument.load(....the xml-document...);

function bookItemsLoaded(){
for (var i=0; i<BookItems.XMLDocument.documentElement.childNodes.length;i++) {
var newOption = document.createElement(&quot;OPTION&quot;);
Book.options.add(newOption);
newOption.innerText = BookItems.XMLDocument.documentElement.childNodes.text;
newOption.value = BookItems.XMLDocument.documentElement.childNodes.getAttribute(&quot;id&quot;);
}
}

</script>

- Then I want to do this:
<script>

for (i = 0; i < Book.options.length; i++)
{
Then my ACTION....
}

</script>

But I can only get the &quot;Book.options.length&quot; if I put a &quot;alert();&quot; in front of the &quot;for()&quot;, because this causes a delay and than I can get the Length.

Does anybody know a way to get the &quot;Book.options.length&quot;? Maby with a DELAY or a chanche of STATUS or maby with ONAFTERUPDATE. You would be very helpfull!!....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top