🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: chile.comp.programacion
Article #3060

Re: ayuda con javascript

#3060
From: Jos� Miguel Santib��ez
Date: Fri, 27 May 2005 04:18
62 lines
2303 bytes
En el cap�tulo anterior (news:d75hqe$fr6$1@news1.nivel5.cl), "+mArkO+" 
<NOSPAMjoin.xtc@gmail.comNOSPAM> dijo:

> como se hace que dando click sobre un texto me seleccione todos los
> elementos de un checkkbox?
> 
> que error hay en este codigo?
> 
> function seleccionar(){
> var nombre;
>  for(x=1;x<=46;x++){
> 
>  nombre="checkn_"+x;
>  nombre.form[0].checked=nombre.checked;
> 
>  }
> }
> 
> habiendo dentro de la pagina un form1 y 46 checkbox con nombre
> checkn_1,checkn_2......
> 
> orientenme un poco porfa
> 
> 

De un checkbox??? hay solo un elemento...
<script>
function marca() {
  document.forma.checkar.checked = true;
}
</script>

<form name=forma>
  <input type=checkbox name=checkar value=1>
  <input type=button onClick="marca()">
</form>

varios:


<script>
function marca() {
  for (i=0; i < 6; i++) {
    document.forma["checkar"+i].checked = true;
  }
}
</script>

<form name=forma>
  <input type=checkbox name=checkar0 value=1>
  <input type=checkbox name=checkar1 value=1>
  <input type=checkbox name=checkar2 value=1>
  <input type=checkbox name=checkar3 value=1>
  <input type=checkbox name=checkar4 value=1>
  <input type=checkbox name=checkar5 value=1>
  <input type=button onClick="marca()">
</form>

-- 
                           Jose M. Santiba�ez A.
                             <jms@nivel5.cl>
                           <http://caos.cl/jms>
Technical Details
Message-ID: <Xns9663302DAB69jmsnews@200.27.221.71>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.vcd.cl!not-for-mail
References: <d75hqe$fr6$1@news1.nivel5.cl>

Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,47254f424c5fc3b1
X-Google-Attributes: gid1593cb,public
X-Google-Language: SPANISH,ASCII
Newsgroups: chile.comp.programacion
Subject: Re: ayuda con javascript
From: "Jos� Miguel Santib��ez" <jms@nospam.nivel5.cl>
References: <d75hqe$fr6$1@news1.nivel5.cl>
Organization: Caos Consultores
Message-ID: <Xns9663302DAB69jmsnews@200.27.221.71>
User-Agent: Xnews/5.04.25
X-Face: +|NgjgFM{<rs%\Q|vUu16]a6,}?MJTA<!PEEI+x&Gw-Gyq+?$}fvo+.(,-r;)~Qzn)#{{nxU,OT?w^s<7m4ckCJ*L$c#I)yHL7b)GdU*#l
NNTP-Posting-Host: 116-58-112.adsl.terra.cl
Date: 27 May 2005 00:18:25 -0400
X-Trace: news.vcd.cl!not-for-mail 1117163905 116-58-112.adsl.terra.cl (27 May 2005 00:18:25 -0400)
Lines: 62
X-Authenticated-User: jms
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!nntp-server.pubsub.com!news1.nivel5.cl!news.vcd.cl!not-for-mail