🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #39860

Re: Jeden radio button zaznaczyć/odznaczyć

#39860
From: Bogdan Blaszczak
Date: Sat, 13 May 2006 16:57
24 lines
1556 bytes
Jaga napisał(a):

> onclick="javascript:
>     if(document.szukaj.foto.checked==true)
>      document.szukaj.foto.checked=false
>     else {
>      document.szukaj.foto.checked=true;
>     }"
> 
> ale pozwala mi go tylko odznaczyć a już zaznaczyć ponownie go nie mogę. 

Jak klikasz niezaznaczony, to najpierw zaznaczasz (na ulamek sekundy), a 
  potem wykonuje sie if
nigdy nie wykonuje sie else

Potrzebujesz zmiennej pomocniczej, powiedzmy X:

<script>X=true</script>
<input type="radio" checked
onclick="this.checked=(X=!X)">


-- 
BlaTek
Technical Details
Message-ID: <e4536b$rai$1@atlantis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <20060513063957.6033.0.NOFFLE@localhost-local>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.tpinternet.pl!atlantis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Bogdan Blaszczak <blatek@UsuN-AntyspaMpoczta.wprost.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: Jeden radio button zaznaczyć/odznaczyć
Date: Sat, 13 May 2006 18:57:10 +0200
Organization: Disorganization Department
Lines: 24
Message-ID: <e4536b$rai$1@atlantis.news.tpi.pl>
References: <20060513063957.6033.0.NOFFLE@localhost-local>
NNTP-Posting-Host: ejc98.internetdsl.tpnet.pl
Mime-Version: 1.0
X-Trace: atlantis.news.tpi.pl 1147539467 27986 83.15.84.98 (13 May 2006 16:57:47 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Sat, 13 May 2006 16:57:47 +0000 (UTC)
User-Agent: Thunderbird
X-Accept-Language: pl, en-us, en
In-Reply-To: <20060513063957.6033.0.NOFFLE@localhost-local>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit