wintercookie
MIS
hey i need help with my form I'm making a test using form in and i want to give 1 pt for every anser that is correct and state it on the side of the text box. I was also wondering if I put the answer on the value ="" will that mean if the text type in the box is not the same as the value then the answer will be wrong? This is what i got so far:
function validate_form ( )
{
valid = true;
if ( document.test.aa.value= "pixel" )
{
alert ( "Please correctly answer question 1." );
valid = false;
}
if ( document.test.ab.value == "" )
{
alert ( "Please fill in the 'question 2' box." );
valid = false;
}
if ( document.test.ac.value == "" )
{
alert ( "Please fill in the 'question 3' box." );
valid = false;
}
if ( document.test.ad.value == "" )
{
alert ( "Please fill in the 'question 4' box." );
valid = false;
}
if ( document.test.ae.value == "" )
{
alert ( "Please fill in the 'question 5' box." );
valid = false;
}
if ( document.test.af.value == "" )
{
alert ( "Please fill in the 'question 6' box." );
valid = false;
}
if ( document.test.ag.value == "" )
{
alert ( "Please fill in the 'question 7' box." );
valid = false;
}
if ( document.test.ah.value == "" )
{
alert ( "Please fill in the '8' box." );
valid = false;
}
return valid;
}
function validate_form ( )
{
valid = true;
if ( document.test.aa.value= "pixel" )
{
alert ( "Please correctly answer question 1." );
valid = false;
}
if ( document.test.ab.value == "" )
{
alert ( "Please fill in the 'question 2' box." );
valid = false;
}
if ( document.test.ac.value == "" )
{
alert ( "Please fill in the 'question 3' box." );
valid = false;
}
if ( document.test.ad.value == "" )
{
alert ( "Please fill in the 'question 4' box." );
valid = false;
}
if ( document.test.ae.value == "" )
{
alert ( "Please fill in the 'question 5' box." );
valid = false;
}
if ( document.test.af.value == "" )
{
alert ( "Please fill in the 'question 6' box." );
valid = false;
}
if ( document.test.ag.value == "" )
{
alert ( "Please fill in the 'question 7' box." );
valid = false;
}
if ( document.test.ah.value == "" )
{
alert ( "Please fill in the '8' box." );
valid = false;
}
return valid;
}