getElementById is not working in a Web application

When i use getElementById to hide one of the field, its not working but if I use the field name, its working. The id is HTML tag of the field.

Can anyone please let me know why its not working?. Appreciate your help.

here is the code

f=window.document.forms[0];

var selectedoption = f.Location.options[f.Location.selectedIndex].text;

if (selectedoption == “Other”) {

f.getElementById("LCother").style.display = "block";

//f.LocOther.style.display = “block”;…This is working fine

} else {

f.getElementById("LCother").style.display = "none";

}

Thanks

sri

Subject: getElementById is not working in a Web application

The getElementById is a method of the document object-

var myElement = document.getElementById(“elementname”)

HTH