Jump to content

on button click to activate reject command


spudly1987

Recommended Posts

Okay guys, i have this code all set up and it seems to be working, however what is not working is when i don't click on the check box and then click on continue to website it still is continuing, how do i fix it so that when i don't check the box, and click on continue it follows through with the reject command

</head>
<div id="wpsp-container">
<!-- === Title === -->
<h1 id="wpsp-title"></h1>
<!-- === Text when a user reject the opt-in === -->
<div id="wpsp-reject">
You don't agree with the terms and conditions.
</div>
<div id="wpsp-text">
main text
</div>
<form method="post">
<input id="wpsp-nonce" type="hidden" value="2b5fd26d94" name="wpsp-nonce" /></input>
<input type="hidden" value="/" name="_wp_http_referer" /></input>
<!-- === Opt-In === -->
<span id="wpsp-opt-in">
<input id="opt-in-checkbox" type="checkbox" value="1" name="opt-in-checkbox"  /></input>
<label for="opt-in-checkbox">
I agree with the terms stated above.
</label>
</span>
<p>
<input id="wpsp-continue" type="submit" value="Continue to Web Site" formaction="index.html"  /></input>
</p>
</form>
</div>
<!-- === END #wpsp-container === --> 
</body>
</html>
Link to comment
Share on other sites

I have made some changes to your code... I think this gets the desired effect:

 

Heres your code with some changes:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function enable(){
if(document.getElementById('opt-in-checkbox').checked = false){
document.getElementById('wpsp-continue').disabled = true;
}else{
document.getElementById('wpsp-continue').disabled = false;
document.getElementById('opt-in-checkbox').checked = true;
}
}
</script>
</head>
<div id="wpsp-container">
<h1 id="wpsp-title"></h1>
<div id="wpsp-reject">You don't agree with the terms and conditions.</div>
<div id="wpsp-text">main text</div>
<form method="post">
<span id="wpsp-opt-in">
<input id="opt-in-checkbox" type="checkbox" onclick="enable();" name="opt-in-checkbox"  /></input>
<label for="opt-in-checkbox">I agree with the terms stated above.</label>
</span>
<input id="wpsp-continue" type="submit" value="Continue to Web Site" formaction="index.html" disabled/></input>
</form>
</div>
</body>
</html>
Edited by josh1600
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.