ASP.NET will manage IDs by adding prefixes for the container the control is in. DropDownList2 may be what you have assigned but when rendered it will be something like $ctrl00_DropDownList2. View the rendered source of your page and you will see this.
Using JQuery you would do this, which will find the control no matter what the prefix is.
$("[id$='DropDownList2']")
You should learn to use JQuery rather then relying on getElementById. It will make your client-side life much easier.