Unable to get the value of the property using javascript
<p>I get the error "Unable to get the value of the property 'checked'. object is null or undefined." when clicking a checkbox.</p>

<p>The form's name is 'test', and I want to display more input fields based on the first check box being checked, if they pass by it then I do not want the other fields displayed.</p>

<p>Here's the script:</p>

<pre><code>function showhidefield()
{
    if (document.test.submode.checked) {
        document.getElementById("hideablearea").style.display = "block";
    } else {
        document.getElementById("hideablearea").style.display = "none";
    }
}
</code></pre>

<p>Here's my input line:</p>

<pre><code>&lt;input type="checkbox" name="submode" onclick="showhidefield()"&gt;
</code></pre>

<p>Is there a way I can make my JS more solid so it works on this other web page and on any browser?</p>
