Help me ->very son->CheckBox

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Nov 2008
Posts: 13
Reputation: baby_1 is an unknown quantity at this point 
Solved Threads: 0
baby_1 baby_1 is offline Offline
Newbie Poster

Help me ->very son->CheckBox

 
0
  #1
Dec 6th, 2008
Hello people
i created this code:
<script langauge=javascript>
function baby(a,b)
{
document.p.text=a;
document.p.cat[b].checked=true;
}
</script>

<form name="p" >
<input type="checkbox" name="cat[10]">
<input type="checkbox" name="cat[11]">
<input type="text" name="text">
</form>

<a href="javascript:baby('Hello',10);">Click Here</a>


when i click on The "Click Here" the textbox show me Hello but the checkbox doesn't work and dosen't get check.

Now How can i do? how can i check of the checkboxes?


Another question:
you assume that i have some checkboxes with the diffrent name such as
<input type="checkbox" name="cat[110]">
<input type="checkbox" name="cat[101]">
<input type="checkbox" name="cat[011]">
.
.
.

now how can i uncheck them at a moment?
Last edited by baby_1; Dec 6th, 2008 at 2:38 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Help me ->very son->CheckBox

 
0
  #2
Dec 6th, 2008
Hi,

try this
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script langauge=javascript>
  4. function baby(a,b)
  5. {
  6.  
  7. document.p.text.value=a;
  8. document.getElementById(b).checked=1;
  9. }
  10. </script>
  11. </head>
  12. <body>
  13.  
  14. <form name="p" >
  15. <input type="checkbox" name="cat(10)" id=10 >
  16. <input type="checkbox" name="cat(11)" id=11 >
  17. <input type="text" name="text">
  18. </form>
  19.  
  20. <a href="javascript:baby('Hello',11);">Click Here</a>
  21. </body>
  22. </html>
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 13
Reputation: baby_1 is an unknown quantity at this point 
Solved Threads: 0
baby_1 baby_1 is offline Offline
Newbie Poster

Re: Help me ->very son->CheckBox

 
0
  #3
Dec 7th, 2008
Thanks a lot kb.net , Thank you very much ,
dear now how can i unchecked al of them with diffrent id or name at a moment? for example:

<input type="checkbox" name="cat(5)" id=5>
<input type="checkbox" name="cat(9)" id=9>
<input type="checkbox" name="cat(20)" id=20 >
<input type="checkbox" name="cat(11)" id=11 >

and how can i hide them?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 13
Reputation: baby_1 is an unknown quantity at this point 
Solved Threads: 0
baby_1 baby_1 is offline Offline
Newbie Poster

Re: Help me ->very son->CheckBox

 
0
  #4
Dec 7th, 2008
no one can help me? i want to do this

how can i unchecked al of them with diffrent id or name at a moment? for example:
<input type="checkbox" name="cat(5)" id=5>
<input type="checkbox" name="cat(9)" id=9>
<input type="checkbox" name="cat(20)" id=20 >
<input type="checkbox" name="cat(11)" id=11 >
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 13
Reputation: baby_1 is an unknown quantity at this point 
Solved Threads: 0
baby_1 baby_1 is offline Offline
Newbie Poster

Re: Help me ->very son->CheckBox

 
0
  #5
Dec 7th, 2008
Please help me
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Help me ->very son->CheckBox

 
0
  #6
Dec 8th, 2008
Hi,

Amend your code to look something like this

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script langauge=javascript>
  4. function baby()
  5. {
  6. for (var x= 1; x<=4 ;x++)
  7. document.getElementById(x).checked=0;
  8. }
  9. </script>
  10. </head>
  11. <body>
  12.  
  13. <form name="p" >
  14. <input type="checkbox" name="cat(5)" id=1 >
  15. <input type="checkbox" name="cat(9)" id=2 >
  16. <input type="checkbox" name="cat(10)" id=3 >
  17. <input type="checkbox" name="cat(12)" id=4 >
  18. </form>
  19.  
  20. <a href="javascript:baby();">Click Here</a>
  21. </body>
  22. </html>
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC