Link to home
Start Free TrialLog in
Avatar of Netlink2
Netlink2

asked on

Microsoft JScript runtime error: 'document.forms.0.cmbState.options' is null or not an object

Hi, the following code works in an aspx page when part of a <head>, but not when part of <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

var state = document.forms[0].cmbState.options[document.forms[0].cmbState.selectedIndex].text;

Can anyone help me with this ?.

Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of Rejojohny
Rejojohny
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Netlink2
Netlink2

ASKER

Hi Rej,
I get the error " Microsoft JScript runtime error: Object required ".
This could be because I'm running the Javascript from a .js file. Any further ideas ?.
OK, The code works (per your response) if I copy the code in to the aspx file itself. Any way I can get it running from a .js file ?.