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="Book" name="Book" SIZE="29" style="width: 225px;"></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("OPTION"
Book.options.add(newOption);
newOption.innerText = BookItems.XMLDocument.documentElement.childNodes.text;
newOption.value = BookItems.XMLDocument.documentElement.childNodes.getAttribute("id"
}
}
</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 "Book.options.length" if I put a "alert();" in front of the "for()", because this causes a delay and than I can get the Length.
Does anybody know a way to get the "Book.options.length"? Maby with a DELAY or a chanche of STATUS or maby with ONAFTERUPDATE. You would be very helpfull!!....
- This is what I Have:
<select id="Book" name="Book" SIZE="29" style="width: 225px;"></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("OPTION"
Book.options.add(newOption);
newOption.innerText = BookItems.XMLDocument.documentElement.childNodes.text;
newOption.value = BookItems.XMLDocument.documentElement.childNodes.getAttribute("id"
}
}
</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 "Book.options.length" if I put a "alert();" in front of the "for()", because this causes a delay and than I can get the Length.
Does anybody know a way to get the "Book.options.length"? Maby with a DELAY or a chanche of STATUS or maby with ONAFTERUPDATE. You would be very helpfull!!....