PDA

View Full Version : Check box access


tomjelfs
04-08-2004, 05:50 AM
This is the script to launch my forumer site:

<script>
function forum(){
var popurl="http://tjays.2.forumer.com"
var winleft = (screen.width - 790) / 2;
var winUp = (screen.height - 600) / 2;

winpops=window.open(popurl,"","width=790,height=600,scrollbars=yes,left="+winleft+",top="+winUp)
}

</script>
<input type=button value="Launch Forums" onClick=javascript:forum()>
</script>

I'm gonna have the rules written above this button. But what I want to know is if there is a way of having a check box that people wishing to enter have to check to say they've read the rules. So basically if they check the agreement box it then makes the button to launch the forums active.

Hope this makes sense

agent002
04-08-2004, 06:26 AM
ok, set disabled="disabled" and id="gobutton" to the <input>, then put this code between the <head> and </head> tags:
<script type="text/javascript">
function agreeClick(w){
if(w.checked)
document.getElementById('gobutton').disabled = false;
else
document.getElementById('gobutton').disabled = true;
}
</script>
and use this code for the checkbox:
<input type="checkbox" onclick="agreeClick(this);"> I agree
:)

tomjelfs
04-08-2004, 06:45 AM
Once again the mighty Agent002 comes to my aide and provides the answer.

Thanks alot.