Using JavaScript To Control Forms - Part 2

wxdqz

New Member
I found this script and it works fine, now I have 1 question :

I now use 0/1/2/3/4 see script

<HTML>
<HEAD>
<TITLE>Required Select Field</TITLE>
<SCRIPT>
function validate() {
if (mainform.Salary.options[0].selected) {
alert('Please choose a Salary Range.');
event.returnValue=false;
}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="mainform" ACTION="http://hoohoo.ncsa.uiuc.edu/cgi-bin/post-query" METHOD="POST" onsubmit="validate();">
<SELECT NAME="Salary">
<OPTION VALUE=http://www.webdeveloper.com/forum/archive/index.php/"0" SELECTED>Salary Range</OPTION>
<OPTION VALUE="1" >Less Than $10,000</OPTION>
<OPTION VALUE="2" >$10,000-$20,000</OPTION>
<OPTION VALUE="3" >$20,000-$30,000</OPTION>
<OPTION VALUE="4" >More than $30,000</OPTION>
</SELECT>
<INPUT TYPE="SUBMIT">
</FORM>
</BODY>
</HTML>

Is it also possible to use A/B/C/D/E ??
When I try it is not working.

Thanks,
Milcoi
 
Back
Top