-
Java script
Hello, I am trying to write a small piece of javascript , and it aint going to plan.
Its on an ASP page,
<script language="JavaScript" type="text/javascript">
var frmvalidator = new Validator("mainform");
if (form1.select1 contains the letter X) then
frmvalidator.addValidation("select1")
</script>
--where form1 is the form name and select1 is a menu/list box.
I basically want to use the addValidation function only when a certain condition is met , that the menu/list box value selected contains an X.
For anyone can understand what i'm trying to say , if you have a knowledge of javascript and an idea of how to solve this problem,
please let me know,
THanks
-
You can get the value of the currently selected option with this line (sel is the select box):
sel.options[sel.selectedIndex].value