Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Łączenie eventów "OnClick", jak można je polaczyc ??
Cog
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 1.06.2009

Ostrzeżenie: (0%)
-----


Witam ,
Jako , ze nie znalazlem takiego tematu na forum pytam w swoim watku.

Przechodzac do sedna :
Robie znajomemu generator , niestety do tego potrzebuje 2 "onClick". Znalazlem 2 skrypty , ktore wykorzystuja 2 rozne , jednak nie wiem jak je polaczyc.


Oto Funkcja:
CODE
<script LANGUAGE="JavaScript">

function countChoices(obj) {
max = 1;

box1 = obj.form.box1.checked;
box2 = obj.form.box2.checked;

count = (box1 ? 1 : 0) + (box2 ? 1 : 0)

if (count > max) {
alert("Oops! You can only choose up to " + max + " choices! \nUncheck an option if you want to pick another.");
obj.checked = false;
}
}
</script>


Tutaj "OnClick" Do niej:
CODE
onClick="countChoices(this)"



A tutaj drugi "onClick":
CODE
<input type="checkbox" name="box1" onClick="document.getElementById('id').style.display = this.checked ? 'block' : 'none'; this.form.elements['nazwa2'].disabled = this.form.elements['nazwa3'].disabled = !this.checked>Sekcja1



Probowalem to zrobic na takiej zasadzie , jednak nie dzialalo :
CODE
<input type="checkbox" name="box2" onClick="document.getElementById('id).style.display = this.checked ? 'block' : 'none'; this.form.elements['nazwa2'].disabled = this.form.elements['nazwa3'].disabled = !this.checked.countChoices(this)">Section 1




Prosilbym o szybka pomoc i z gory dziekuje.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.08.2025 - 15:38