This Tutorial Has Been Viewed 9,055 Times.
VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)

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

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)



coded by nessus
Categories: JavaScripts, scripts

Leave a Reply