This Tutorial Has Been Viewed 9,055 Times.
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>
You will also be interested in ,
- Drop down menu going behind flash element
- Close Event In Javascript For Firefox, IE and Chrome
- Simple message slideshow news ticker using javascript
- Javascript setTimeout() Tricks
- Get IP address using javascript And SSI
- Dynamically Changing hyperlink color on a website using javascript
- Close Event In Javascript Using OnUnload()
- Simple Javascript Clock
- Change webpage background color using javascript
- Finding The Size Of Images Using Javascript
Categories: JavaScripts, scripts