iel Posted September 24, 2003 Report Share Posted September 24, 2003 Ai pessoal seguinte eu tenho este codigo e ele não ta dando certo, algum poderia me dar uma luz do porque não ta funcionando!valeu heim!<html> <head> <title>Teste</title> <script> function validacao(obj){ for(i=0;i<obj.length-1;i++) { if (obj.elements[i].cb >= 0) { itens=0; de = i; ate = eval(de) + eval(obj.elements[i].cb); for (x=de; x<=ate; x++) { if(obj.elements[x].checked) { itens++; } } if (itens > 8) { alert("SELECIONE NO MAXIMO 8" ); obj.elements[i].focus(); return false; } } } } </script> </head> <body> <form name="form1" method="post" action=""> <table width="50%" border="1" cellspacing="0" cellpadding="0"> <tr> <td colspan="5">Escolha as opções</td> </tr> <tr> <td><input name="itens" type="checkbox" id="itens" value="item1" cb="19"> Item1</td> <td><input name="itens" type="checkbox" id="itens" value="item2"> Item2</td> <td><input name="itens3" type="checkbox" id="itens" value="item3"> Item3</td> <td><input name="itens4" type="checkbox" id="itens" value="item4"> Item4</td> <td><input name="itens5" type="checkbox" id="itens" value="item5"> Item5</td> </tr> <tr> <td><input name="itens6" type="checkbox" id="itens" value="item6"> Item6</td> <td><input name="itens7" type="checkbox" id="itens" value="item7"> Item7</td> <td><input name="itens8" type="checkbox" id="itens" value="item8"> Item8</td> <td><input name="itens9" type="checkbox" id="itens" value="item9"> Item9</td> <td><input name="itens10" type="checkbox" id="itens" value="item10"> Item10</td> </tr> <tr> <td><input name="itens11" type="checkbox" id="itens" value="item11"> Item11</td> <td><input name="itens13" type="checkbox" id="itens" value="item12"> Item12</td> <td><input name="itens15" type="checkbox" id="itens" value="item13"> Item13</td> <td><input name="itens17" type="checkbox" id="itens" value="item14"> Item14</td> <td><input name="itens19" type="checkbox" id="itens" value="item15"> Item15</td> </tr> <tr> <td><input name="itens12" type="checkbox" id="itens" value="item16"> Item16</td> <td><input name="itens14" type="checkbox" id="itens" value="item17"> Item17</td> <td><input name="itens16" type="checkbox" id="itens" value="item18"> Item18</td> <td><input name="itens18" type="checkbox" id="itens" value="item19"> Item19</td> <td><input name="itens20" type="checkbox" id="itens" value="item20"> Item20</td> </tr> </table> <p> <input type="submit" name="Submit" value="Enviar" onSubmit="return validacao(this)"> </p> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
0 André Gusmão Posted September 24, 2003 Report Share Posted September 24, 2003 Aqui está o erro:<input type="submit" name="Submit" value="Enviar" onSubmit="return validacao(this)">Retire o onSubmit daqui e coloque-o aqui:<form name="form1" method="post" action="" onSubmit="return validacao(this)"> Quote Link to comment Share on other sites More sharing options...
Question
iel
Ai pessoal seguinte eu tenho este codigo e ele não ta dando certo, algum poderia me dar uma luz do porque não ta funcionando!
valeu heim!
Link to comment
Share on other sites
1 answer to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.