Click to See Complete Forum and Search --> : Please help me


mom2my3kids
09-13-2003, 09:18 AM
I am trying to figure out how to make a code work properly. Someone showed me this code to use but it doesn't work right. I have a form for my company website that I want a question to be answered yes or no. If answered no then nothing changes on the form. However, if yes is answered then there will be 7 more fields that will open up for the user to enter text.

The page as it appears originally is located at www.normancope.com/infosheet.html

The test page with the code given me is www.normancope.com/test.html

and the code I was given is this:

This in head

<script language="JavaScript">
function open() {
obj = getElementById("formfields");
obj.style.display="block";
}
</script>


<input type="button" onClick="open();" value="Yes">

Now for the bit that appears:

<div ID="formfields" style="display:none;">
STUFF THAT WILL APEAR GOES HERE!
</div>


Please help me!
:confused:

Fang
09-13-2003, 10:34 AM
2 mistakes:
open is a method of window. Never use reserved words, methods, property names etc when defining your own functions or variables - It can cause a problem ;)
Secondly it's document.getElementById("formfields");