-
Path: news-archive.icm.edu.pl!newsfeed.gazeta.pl!wsisiz.edu.pl!plix.pl!newsfeed1.plix
.pl!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!newsfe
ed.freenet.de!feeder.news-service.com!postnews.google.com!y7g2000yqa.googlegrou
ps.com!not-for-mail
From: Mossy <m...@g...com>
Newsgroups: pl.comp.www
Subject: zmienna liczba pól formularza
Date: Tue, 7 Jul 2009 07:51:31 -0700 (PDT)
Organization: http://groups.google.com
Lines: 130
Message-ID: <5...@y...googlegroups.com>
NNTP-Posting-Host: 87.192.184.141
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1246978292 31232 127.0.0.1 (7 Jul 2009 14:51:32 GMT)
X-Complaints-To: g...@g...com
NNTP-Posting-Date: Tue, 7 Jul 2009 14:51:32 +0000 (UTC)
Complaints-To: g...@g...com
Injection-Info: y7g2000yqa.googlegroups.com; posting-host=87.192.184.141;
posting-account=Ni-MXQoAAADnaon4UD-vPVl73Zyve481
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pl; rv:1.9.0.11)
Gecko/2009060215 Firefox/3.0.11,gzip(gfe),gzip(gfe)
Xref: news-archive.icm.edu.pl pl.comp.www:392811
[ ukryj nagłówki ]Witam serdecznie,
potrzebuje formularz, w którym zależnie od liczby wybranej z menu
select (1 do 5) aktywna będzie odpowiednia liczba pól na wpisanie np.
nazwika i numeru telefonu. Odpowiednio dla jednej osoby po jednym
polu, dla 5 osób po pięć pól.
Poniższy kod działa pod FF i Opera, a nie chce działać dla IE.
Uprzejmie proszę o pomysły, co zrobić aby w IE też działało oraz
ewentualnie jak to uprościć w ogóle.
<form method="post" target="_blank" action="./plik.php">
<div >
<div align="left" style="float:left; width:40px">
No.<br />
<select name="quantity" tabindex="7" >
<option value="1" onclick="document.getElementById
('person1').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person2').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person3').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person4').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person5').style.display = this.selected ? 'none' :
'block';">1 </option>
<option value="2" onclick="document.getElementById
('person1').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person2').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person3').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person4').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person5').style.display = this.selected ? 'none' : 'block';
this.form.elements
['student2'].disabled = this.form.elements['mobile2'].disabled = !
this.selected;" >2 </option>
<option value="3" onclick="document.getElementById
('person1').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person2').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person3').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person4').style.display = this.selected ? 'none' : 'block';
document.getElementById
('person5').style.display = this.selected ? 'none' : 'block';
this.form.elements
['student2'].disabled = this.form.elements['mobile2'].disabled =
this.form.elements['student3'].disabled = this.form.elements
['mobile3'].disabled = !this.selected" >3 </option>
<option value="4" onclick="document.getElementById
('person1').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person2').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person3').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person4').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person5').style.display = this.selected ? 'none' : 'block';
this.form.elements
['student2'].disabled = this.form.elements['mobile2'].disabled =
this.form.elements['student3'].disabled = this.form.elements
['mobile3'].disabled = this.form.elements['student4'].disabled =
this.form.elements['mobile4'].disabled = !this.selected"
>4 </option>
<option value="5" onclick="document.getElementById
('person1').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person2').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person3').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person4').style.display = this.selected ? 'block' : 'none';
document.getElementById
('person5').style.display = this.selected ? 'block' : 'none';
this.form.elements
['student2'].disabled = this.form.elements['mobile2'].disabled =
this.form.elements['student3'].disabled = this.form.elements
['mobile3'].disabled = this.form.elements['student4'].disabled =
this.form.elements['mobile4'].disabled = this.form.elements
['student5'].disabled = this.form.elements['mobile5'].disabled = !
this.selected" >5 </option>
</select>
</div>
<div align="left" style="float:left; width:350px">
<div align="center" style="float:left; width:
160px">First & Last Name</div><div>Mobile No.</div>
<div id="person1">
<input type="text" name="student1" tabindex="8">
<input type="text" name="mobile1" value="08*******1"
tabindex="9">
</div>
<div id="person2" style="display: none">
<input type="text" name="student2" tabindex="10"
disabled="disabled" />
<input type="text" name="mobile2" value="08*******2"
tabindex="11" disabled="disabled" />
</div>
<div id="person3" style="display: none">
<input type="text" name="student3" tabindex="12"
disabled="disabled" />
<input type="text" name="mobile3" value="08*******3"
tabindex="13" disabled="disabled" />
</div>
<div id="person4" style="display: none">
<input type="text" name="student4" tabindex="14"
disabled="disabled" />
<input type="text" name="mobile4" value="08*******4"
tabindex="15" disabled="disabled" />
</div>
<div id="person5" style="display: none">
<input type="text" name="student5" tabindex="16"
disabled="disabled" />
<input type="text" name="mobile5" value="08*******5"
tabindex="17" disabled="disabled" />
</div>
</div>
</div>
</form>
Następne wpisy z tego wątku
- 07.07.09 23:08 Paweł Piskorz
- 07.07.09 23:30 rezist.com
Najnowsze wątki z tej grupy
- Jakie znacie działające serwery grup dyskusyjnych?
- is it live this group at news.icm.edu.pl
- php, linki z nazwami a $_GET, SEO
- www polityka pl captcha
- dyktatura brudnego palucha
- www.znanylekarz.pl
- Czy pytanie o sczytywanie stron programami/skryptami to tu?
- Grupy webdevowe
- Jak wydrukować stronę?
- IIS, kilka witryn
- linki <a href="/strona.php"> (ze slashami)
- co rozszerza stronę??
- responsywny akapit <p>
- Czy istnieje jakiś emulator przeglądarek pod Mac'a?
- taka sama konfiguracja dla localhost i produkcji
Najnowsze wątki
- 2025-01-30 pogromca ksiezy
- 2025-01-30 Warszawa => Data Engineer (Tech Lead) <=
- 2025-01-30 Czy WYNIESIENIE UE-posła Brauna z sali obrad UE-parlamentu stanowiło naruszenie jego immunitetu i godności?
- 2025-01-30 drukarka potrzebna
- 2025-01-30 Warszawa => QA Engineer (Quality Assurance) <=
- 2025-01-30 Łódź => Programista NodeJS <=
- 2025-01-30 Jest Trump prezydent jest Meta/FBook/Instagram ugoda za 25 mln. USD
- 2025-01-30 Gdańsk => Solution Architect (Java background) <=
- 2025-01-30 Zielona Góra => Senior Field Sales (system ERP) <=
- 2025-01-30 Błonie => Analityk Systemów Informatycznych (TMS SPEED) <=
- 2025-01-30 DeepSeek nie lubi gadać o polityce
- 2025-01-30 Błonie => Administrator systemów <=
- 2025-01-30 Gliwice => Business Development Manager - Network and Network Security
- 2025-01-30 Warszawa => Programista Full Stack (.Net Core) <=
- 2025-01-30 Faktura z czech.