Script Categories

Forms >>> Agree Before Entry.

JavaScript will only let you enter your name in this form if you indicate you agree to the terms by first clicking the I Agree radio button. 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.

You can only enter your name if you agree to the terms. (just a demo)

I agree
I disagree
Please enter your name:

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">
/* Visit for full source code
and get more free JavaScript, CSS and DHTML scripts! */
agree = 0;  // 0 means 'no', 1 means 'yes'
<form name=enableform>
You can only enter your name if you agree to the terms. (just a demo)<br>
<input type=radio name='enable' value='agree' onClick="agree=1;;">I agree<br>
<input type=radio name='enable' value='disagree' onClick="agree=0;'';">I disagree<br>
Please enter your name:
<input type=text name=box onFocus="if (!agree)this.blur();" onChange="if (!agree)this.value='';" size=12>
<input type=submit value="Done!">

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.

Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

NCEdCloud - IAM Service - NCEDCloud Login