<script type="text/javascript">
function validate(form) {
// Checking if at least one period button is selected. Or not.
if (!document.form1.sex[0].checked && !document.form1.sex[1].checked){
alert("Please Select Gender");
return false;}
var total=""
for(var i=0; i < document.form1.scripts.length; i++){
if(document.form1.scripts[i].checked)
total +=document.form1.scripts[i].value + "\n"
}
if(total=="")
alert("select scripts")
else
alert (total)
return false;
}</script>
<table border='0' width='50%' cellspacing='0' cellpadding='0' >
<form name=form1 method=post action=action_page.php onsubmit='return validate(this)'>
<input type=hidden name=todo value=post>
<tr bgcolor='#ffffff'><td align=center ><font face='verdana' size='2'><b>gender</b>
<input type=radio name=gender value='male'>Male </font>
<input type=radio name=gender value='female'>
<font face='verdana' size='2'>Female</font></td></tr>
<tr><td align=center bgcolor='#f1f1f1'><font face='verdana' size='2'>
<b>Scripts You know</b><input type=checkbox name=scripts value='JavaScript'>JavaScript
<input type=checkbox name=scripts value='PHP'>PHP
<input type=checkbox name=scripts value='HTML'>HTML </td></tr>
<tr bgcolor='#ffffff'><td align=center >
<input type=submit value=Submit> <input type=reset value=Reset></td></tr>
</table></form>
Nagarjuna | 03-12-2012 |
(BY USING JAVA SCRIPT)In my application i have one required i,e I have multiple number of check boxes(suppose 10 boxes). when i am going to click a button like lucky dip ,it has to select 6 random check boxes automatically (when i click same button for another time i want to get different 6 values from 10 initial values apart from first values). (I am able to checked 6 boxes(not different values) from 10 check boxes ) could you please give me some suggestions . |
yash | 03-05-2013 |
hii.. i m yash... sorry for first comment... hii i have some problem. plz suggest me the write way to solve my querru.... i have a form .. with multiple checkbox and a search button.... i want when no checkbox is selected then the search button is disappear ... i any one is selected then this search button show... plz send me a code for this... thanx |