It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

working with arrays

working with arrays

Postby fismayil on Sun Apr 24, 2011 8:17 am

I have the following code where I try to check if A, ...., &#197 checkboxes are checked A2,......, &#1972 text field also should be filled. If any of textboxes is not field code user shoul receive please, type text.

I am not good in JavaScript and hope someone will help me. I can not find mistake in code. Also what is interesting for is it possible to do the same thing without declaring second array?

<script language="JavaScript" type="text/javascript">
<!--
function checkform ( form )
{
var letters=new Array("A", "B", "C", "D","E", "F", "G", "H","I", "J", "K", "L",
"M", "N", "O", "P","Q", "R", "S", "T","U", "V", "W", "X",
"Y", "Z", "&#198", "&#216", "&#197");

var letters2=new Array("A2", "B2", "C2", "D2","E2", "F2", "G2", "H2","I2", "J2", "K2", "L2",
"M2", "N2", "O2", "P2","Q2", "R2", "S2", "T2","U2", "V2", "W2", "X2",
"Y2", "Z2", "&#1982", "&#2162", "&#1972");

// ** START **
for (i=0;i<=29;i++){
if (document.myform.letters[i].checked == true) && (form.letters2[i].value == ''){
alert( Please, fill in all required textboxes );
form.A2.focus();
return false ;
}
}
// ** END **
return true ;
}
//-->
</script>
fismayil
 
Posts: 1
Joined: Sun Apr 24, 2011 8:10 am

Re: working with arrays

Postby rajmv on Sun Jul 17, 2011 4:45 pm

please post a url where we can view this problem in action.

right now your html is missing from your code so i can't help you
rajmv
100+ Club
 
Posts: 103
Joined: Thu Jul 14, 2011 7:22 am


Who is online

Users browsing this forum: No registered users and 4 guests