Tzafrir
03-17-2003, 10:10 AM
Hi guys,
I have a web page which may have one drop down menu or more and they all have the same name being Mark. When there are a few of the drop down menus I get the correct number but when there is only one the number of options in the drop down menu appear what am i doing wrong, here is the javascript im using:
<script language ="JavaScript">
<!-- Begin hiding here --
function alertbox(x)
{
var e = "";
var r = true;
var t = true;
var s = 0;
s = x.Mark.length
if(x.Password.value == "")
{
e += "\nPlease enter a Password";
r = false;
}
if(eval(x.Choice[0].checked)!==true && eval(x.Choice[1].checked)!==true)
{
e += "\nPlease select whether you would like the Save or Submit the Mark sheet";
r = false;
}
if(eval(x.Choice[1].checked)==true)
{
for(var i=0;i<s;i++)
{
if(eval(x.Mark[i].value==""))
{
e += "\nPlease enter grade for student "+ x.Number[i].value +" before submitting";
r = false;
}
}
}
if(r == false)
{
alert("The following must be completed first:\n"+e);
}
return r;
}
// -- End hiding here -->
</script>
Can anyone help ??
Thanks
Tzaf
I have a web page which may have one drop down menu or more and they all have the same name being Mark. When there are a few of the drop down menus I get the correct number but when there is only one the number of options in the drop down menu appear what am i doing wrong, here is the javascript im using:
<script language ="JavaScript">
<!-- Begin hiding here --
function alertbox(x)
{
var e = "";
var r = true;
var t = true;
var s = 0;
s = x.Mark.length
if(x.Password.value == "")
{
e += "\nPlease enter a Password";
r = false;
}
if(eval(x.Choice[0].checked)!==true && eval(x.Choice[1].checked)!==true)
{
e += "\nPlease select whether you would like the Save or Submit the Mark sheet";
r = false;
}
if(eval(x.Choice[1].checked)==true)
{
for(var i=0;i<s;i++)
{
if(eval(x.Mark[i].value==""))
{
e += "\nPlease enter grade for student "+ x.Number[i].value +" before submitting";
r = false;
}
}
}
if(r == false)
{
alert("The following must be completed first:\n"+e);
}
return r;
}
// -- End hiding here -->
</script>
Can anyone help ??
Thanks
Tzaf