James Cochrane
asked on
Having An HTML Checkbox Call A JavaScript Function
ClickBank requires for recur bill products to have a checkbox that the value is sent to the ClickBank payment processing that indicates whether the customer accepted (checked) or declined (not checked) the billing agreement. ClickBank gives the following code as an example:
<script type="text/javascript">
function toggleAccept() {
var acceptLink = document.getElementById("a ccept");
var agreeCheckbox = document.getElementById("a greeCheckb ox");
if (agreeCheckbox.checked) {
acceptLink.onclick=functio n() {
window.location=this.href + "&cbrblaccpt=true";
return false;
}
} else {
acceptLink.onclick=functio n() {
mustAccept();
return false;
}
}
}
function mustAccept() {
window.alert("By clicking accept, you agree to the payment terms of this recurring product.");
}
cbrblaccptl
</script>
My HTML/JavaScript is a bit rusty. How would I set up the checkbox in HTML to call the above code?
Thanks,
<script type="text/javascript">
function toggleAccept() {
var acceptLink = document.getElementById("a
var agreeCheckbox = document.getElementById("a
if (agreeCheckbox.checked) {
acceptLink.onclick=functio
window.location=this.href + "&cbrblaccpt=true";
return false;
}
} else {
acceptLink.onclick=functio
mustAccept();
return false;
}
}
}
function mustAccept() {
window.alert("By clicking accept, you agree to the payment terms of this recurring product.");
}
cbrblaccptl
</script>
My HTML/JavaScript is a bit rusty. How would I set up the checkbox in HTML to call the above code?
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks