HighDots Forums  

Re: checkbox help needed

Javascript JavaScript language (comp.lang.javascript)


Discuss Re: checkbox help needed in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kaeli
 
Posts: n/a

Default Re: checkbox help needed - 09-25-2003 , 08:57 AM






In article <bkt2hd$ind$1 (AT) blue (DOT) rahul.net>, jeep (AT) 55 (DOT) usenet.us.com
enlightened us with...
Quote:
Im totally new to javascript. Im working on a webpage that I need to
make sure the user has checked at least one answer to each question
in the list. I cant seem to figure out the logic or something.

Tested successfully in IE.

<script type="text/javascript" language="javascript">
function check_form(f)
{
var forgot;
for (var i=1; i<18; i++)
{
forgot=true;
var l=f.elements["PCLM"+i].length;
for (j=0; j<l; j++)
{
if (f.elements["PCLM"+i][j].checked==true) forgot=false;
}
if (forgot)
{
alert("You forgot one. Number: "+i);
return false;
}
}
return true;
}
</script>

-------------------------------------------------
~kaeli~
All I ask for is the chance to prove that money
cannot make me happy.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.