Link to home
Start Free TrialLog in
Avatar of stevefNYC
stevefNYC

asked on

JavaScript onclick inquiry

I have a form with a checkbox that must be clicked before the form can be processed.  My code for the checkbox looks like this:

<input type="checkbox" name="iagree" id="iagree" onclick="clickIagree()"> I agree

and clickIagree() looks like this:

function clickIagree() {
      if (document.signupform.iagree.checked==true) {
            document.signupform.signup.disabled = false;
      } else {
            document.signupform.signup.disabled = true;            
      }
}

My error debug message is saying document.signupform.signup has no properties. Although I do have a signup form:

<form name="signupform" method="POST" action="thank_you.php" >

Perhaps it is my input image?

<input type="image" src="img/push-signup-small.png" style="margin: 0; padding: 0; cursor: pointer;" disabled onclick="verifyinput()" id="signup" name="signup">

Thanks.
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

For some strange reasons is the input type=image NOT member element of form elements collection.
You have to get it by ID.

@stevefNYC,

As per my knowledge you can't disable an image button.

I can provide you an alternative....write an innerHTML to the the div...write out <img src=""> without the anchor tag when you want to disable
ASKER CERTIFIED SOLUTION
Avatar of sint4x
sint4x
Flag of Canada 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