JavaScript for chechBoxes?
>> Friday, June 17, 2011
CHECHBOXES VALIDATIONS
<html> <title>checkboxesValidation</title> <head> <script type="text/javascript"> function CheckLikes(thisform) { boxes = document.f1.Liked.length txt = "" for (i = 0; i < boxes; i++) { if (document.f1.Liked[i].checked) { txt = txt + document.f1.Liked[i].value + " " } } if (txt == "") { Message = "No Likes Boxes ticked" + "\n" alert("plz selected any one the check boxes"); } else { Message = "" } return false; } </script> </head> <body> <form action="/bhaskar" name="f1" > <table> <tr> <td height="150" valign="top" colspan="2"> </td> <td valign="top" width="240"> <b>What did you like about the Site?</b> <p> <input type="checkbox" name="Liked" value="Cool Layout"> Cool Layout</p> <p> <input type="checkbox"name="Liked" value="Easy to Navigaten"> Easy to Navigate</p> <p> <input type="checkbox" name="Liked" value="Great Contents"> Great Contents</p> </td> </table> <input type="submit" onclick="CheckLikes(f1);return false">submit</input> </body> </html>
0 comments:
Post a Comment