Last updated on May 11th, 2016 at 03:07 pm

Agree before entry using Javascript

with button disable functionality,that means if you agree, you can enter your name. But, if you disagree, you will not be able to enter or edit your name. When you disagree, the box is ‘locked.’ Useful if you require your visitors to accept a disclaimer before downloading software or visiting a section of your members-only site.

<head>
<script LANGUAGE="JavaScript">
agree = 0;  // 0 means 'no', 1 means 'yes'
</script>
</head>
<form name=agree_form>
You can only enter your name if you agree to the terms. (just a demo)<br />
<br />
<input type=radio name='enable' value='I agree with Terms & Conditions' onClick="agree=1; document.agree_form.box.focus();document.getElementById('subm').disabled = false"/>I agree with Terms & Conditions<br />
<input type=radio name='enable' value='I disagree with Terms & Conditions' onClick="agree=0; document.agree_form.box.value='';document.getElementById('subm').disabled = true;
"/>I disagree with Terms & Conditions<br />
Please enter your name:
<input type=text name=box onFocus="if (!agree)this.blur();" onChange="if (!agree)this.value='';" size=12/>
<br />
<br />
<input type=submit id="subm" value="Done"/>
</form>

DEMO

One thought on “Agree Before Entry Using Javascript”
  1. I just like the helpful info you supply on your articles. I will bookmark your blog and take a look at once more here regularly. I’m somewhat sure Ill learn a lot of new stuff right right here! Best of luck for the following!

Leave a Reply

Your email address will not be published. Required fields are marked *