[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with code...



Dan "Lumberjack" Brown wrote:
> 
> Suppose I have a form with a <select> object in it and I want to precede
> that object with a bit of text that says how many options are in it.  I
> tried using this code:
> 
> <body>
> 
> <script language="JavaScript">
> document.write ("<p>There are " +
>         document.myform.myselect.options.length +
>         " options in the following select box.");
> </script>
> 
> <p><form method="POST" name="myform">
> 
> <select name="myselect">
> <option>Option 1
> <option>Option 2
> <option>Option 3
> </select>
> 
> </form>
> 
> I keep getting a "myform has no properties" error.  Am I missing something?
> You are accessing myform before it has been defined in the form
statement.