troubleshooting Question

I am trying to toggle a fieldset in javascript however I am having trouble here is a snippet of my code

Avatar of 1030071002
1030071002Flag for United States of America asked on
JavaScriptHTMLCSS
6 Comments5 Solutions294 ViewsLast Modified:
I am trying to toggle a fieldset in javascript however I am having trouble here is a snippet of my code

<fieldset class="shipBillSame">
	<label> IF THE CUSTOMER INFO IS THE SAME AS THE BILL TO CLICK THE BOX :
	<input type="checkbox" name="option" id="option1" value=""  onClick="checkAddress();"/>
   </label>
</fieldset>

<div id="priv_info">
    <fieldset class="billto">
    
    <legend>Bill To</legend>
        <label>Name : </label><input name="billto_name"  maxlength="49" id="billto_name" type="text" ><span class="req">*</span>
        <label>Address : </label>
        <input name="billto_address"  maxlength="49"  id="billto_address" type="text"><span class="req">*</span>
        <label>City/State/Zip : </label>
        <input name="billto_city"  maxlength="30" id="billto_city" type="text" class="shortInput1"  />
        <input name="billto_state"  maxlength="2" id="billto_state" type="text" class="shortInput2"  /> 
        <input name="billto_zip" maxlength="8"  type="text" id="billto_zip" class="shortInput3"  /><span class="req">*</span> 
        <label>Contact : </label>
        <input name="billto_contact" maxlength="30"  id="billto_contact" type="text"><span class="req">*</span>
        <label>Email : </label>
        <input name="billto_email" maxlength="49"  id="billto_email" type="text">
        <label>Phone/Fax : </label>
        <input name="billto_tel" maxlength="20"  id="billto_phone" type="tel"> 
        <input name="billto_fax" maxlength="20"  id="billto_fax" type="tel"><span class="req">*</span></legend>
    </fieldset>
</div>

<fieldset>
  <legend>Secret Question and Answer</legend>
  <label>Secret Question : </label><input name="secret_question"  maxlength="49" id="Secret_Question" type="text" ><span class="req">*</span>
  <label>Answer : </label><input name="secret_answer"  maxlength="49" id="Answer" type="text" ><span class="req">*</span>
</fieldset>

<div class="buttons"><input type="submit" name="Submit" id="Submit" value="Submit" tabindex="0">
    <input type="reset" name="New" id="reset" value="reset" tabindex="1">
    <input type="button" name="Exit" id="Exit" value="Exit" onClick="self.close()" tabindex="2">
</div>
</form>  

<script type="text/javascript">
function prepareForm(){
	if(!document.GetElementByid){
		return false
	}
	var form = document.GetElementById('registration');
	togglebillto = form.elements["option"];
	togglebillto.onclick = togglePrivInfo;
	togglebillto.onclick();
    }
	function togglePrivInfo(){
		toggle('priv_info');
	}
	function toggle(id){
	 var element = document.getElementByid(id);
	 var display = (element.style.display === 'none') ? '' : 'none';
	 element.style.display = display;	
	}
	prepareForm();
</script>
ASKER CERTIFIED SOLUTION
Proculopsis

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 5 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros