Script Categories













Forms >>> Validation Selection.

Use Javascript to ensure that visitors choose both a radio button and a checkbox. Invalid submissions are cancelled.

MENU RADIOS

Will you be back here?
YES NO MAYBE


MENU: RADIO:

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

<script language="javascript" type="text/javascript">
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!--  Begin
var menu_selection="";
var radio_selection="";
function  checkForm() {
if (dropDownMenu() && radioButtons()) {
document.check.results1.value=menu_selection;
document.check.results2.value=radio_selection;
alert("\nForm has been filled out correctly.");
   }
}
function dropDownMenu(form)  {
var myindex=document.check.menu.selectedIndex;
if (myindex==0) {
alert("\nYou must make a selection from the drop-down menu.");
document.check.menu.focus();
}
else {
menu_selection=document.check.menu.options[myindex].value;
return true;
   }
}
function radioButtons() {
if (radio_selection=="")
alert("\nYou must check one of the radio buttons.");
else {
return true;
   }
}
function resetForm() {
document.check.menu.options[0].selected = true;
menu_selection="";
radio_selection="";
}
function about() {
alert("\nVALIDATOR checks to see that a selection has been made from  the drop-down menu and that a radio button has been checked.\n\nIf filled out properly, the data will be displayed below.");
}
// End -->
</script>
<FORM name="check">
<TABLE BORDER=4  WIDTH=500>
<TR>
<TD
align="center"><FONT SIZE=+1><B>MENU</B></FONT>
<TD align="center"><FONT SIZE=+1><B>RADIOS</B></FONT>
</TR>
<TR>
<TD
align="center"><SELECT NAME="menu" SIZE=1>
<OPTION
SELECTED VALUE=""> --- How many times have you been here?  ---
<OPTION VALUE="one">Once
<OPTION VALUE="two">Twice
<OPTION VALUE="three">Three times
<OPTION VALUE="four">Four times
<OPTION VALUE="five">Five times
<OPTION VALUE="six">Six times
<OPTION VALUE="seven">Seven times
<OPTION VALUE="eight">Eight times
<OPTION VALUE="nine">Nine times
<OPTION VALUE="ten">Ten+ times
</SELECT>
<TD align="center"><BR>Will you be back here?<br>
<INPUT TYPE="radio" NAME="radiobutton" onClick="radio_selection='yes'">YES
<INPUT TYPE="radio" NAME="radiobutton" onClick="radio_selection='no'">NO
<INPUT TYPE="radio" NAME="radiobutton" onClick="radio_selection='maybe'">MAYBE
</TR>
</TABLE>
<BR>
<TABLE BORDER=0 WIDTH=400>
<TD
align="center"><INPUT TYPE="reset"   VALUE="Reset" onClick="resetForm()">
<TD align="center"><INPUT TYPE="button" VALUE="Check Form Fields" onClick="checkForm()">
<TD align="center"><INPUT TYPE="button" VALUE="About" onClick="about()">
</TABLE>
<BR>
<TABLE BORDER=4 WIDTH=250>
<TR>
<TD
align="center">MENU:
<TD align="center">RADIO:
</TR>
<TR>
<TD
align="center"><INPUT  TYPE="text"  NAME="results1" SIZE=7>
<TD align="center"><INPUT  TYPE="text"  NAME="results2" SIZE=7>
</TR>
</TABLE>
<BR>
</FORM>

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!).

http://www.cashadvance-loans.net/texas/cash-advance-corpus-christi-tx/ . Bitcoin Dice - Crypto Casino


©