I believe we cannot just choose either to use getElementByID or getting the complete path by doing document.someelement.somechildelement etc…
Can we use a selectIndex by using getElementByID
can we apply a display.none by using document.someelement. etc?
If not, as I apparently believe, why not?
Those are some questions that I would like to ask, I don’t need a big answer, just some orientation points.
I believe that, the fact we cannot use both at will, must be related with the DOM structure?
Am I completely wrong?
Márcio
ps - I have some questions on other posts that I need to reply to, I will do it. It just requires time to analyze, and I needed to ask this before I forget it.
Once you get a proper reference to a dom node, you can set properties on it.
<select id=“mySelect”…
var selectElement = document.getElementById("mySelect");
selectElement.selectedIndex = 2;
selectElement.style.display = "none";
In general, stay away from getting references to nodes that seem to magically appear by their id or name attribute in the document object(don’t do document.someName). There’s a lot of non-standard browser differences. Well, to be honest, the entire dom is a mine field due to all the browser inconsistencies, but that’s another topic.