Workaround for document.getElementById("mydiv").style.display='none'

  • Thread starter gimme_this_gimme_that
  • Start date
G

gimme_this_gimme_that

Hi,

I have an onchange method for a select box that goes something like
this (the select is in a form named aForm):

function page_on_change() {
pageElement = aForm.my_page_id;
aForm.nav_page_name.value =
pages[pageElement.options[ pageElement.selectedIndex ].value];
var si = pageElement.selectedIndex;
for ( i = 0 ; i < pages.size ; i++ ) {
document.getElementById("id_" + i).style.display='none';
}
document.getElementbyId("id_" + si).style.display='none';
}

IE fails on the statement:

document.getElementbyId("id_" + si).style.display='none';

and says it doesn't support this property.

What is the workaround?

Thanks.
 
G

gimme_this_gimme_that

Thanks Walton,

Great catch.

Now a message popus up that says Object required.

I've eyeballed the source and confirmed that divs id_0,id_1 etc exist.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top