How would I set a checkbox to activate a link in a wordpress blog?
I want to be able to let people download stuff from the blog, like code for people to use. But I want to make sure people read the "License/Copyright" stuff before hand. It would say something like, "Check to agree to terms and开发者_JAVA百科 conditions" and when they click it the download link is activated.
Bonus: records their IP address from where they downloaded it, and the time when they downloaded it.
If you are using jQuery, you could do something like this:
$('.checkbox').click(function() {
if (this.checked) {
window.location.href = "/url/to/download";
}
else {
// error handling
}
})
If you're not using jQuery let me know and I'll whip up a pure Javascript example.
精彩评论