![]() |
![]() ![]() |
![]() |
![]()
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. |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 6 476 Pomógł: 1306 Dołączył: 6.08.2006 Skąd: Kraków Ostrzeżenie: (0%) ![]() ![]() |
|
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 1.06.2009 Ostrzeżenie: (0%) ![]() ![]() |
Problem polega na tym , ze to nie sa 2 funkcje. Tylko "countChoices(this)" jest funkcja. Pierwszy czlon nie ma zapisanej nigdzie indziej funkcji.
|
|
|
![]()
Post
#4
|
|
![]() Grupa: Zarejestrowani Postów: 1 366 Pomógł: 261 Dołączył: 23.09.2008 Skąd: Bydgoszcz Ostrzeżenie: (0%) ![]() ![]() |
Kod this.form.elements['nazwa2'].disabled = this.form.elements['nazwa3'].disabled = !this.checked.countChoices(this) Imo tu masz błąd instrukcje w JS oddzielasz średnikami, nie ważne czy to sa funkcje czy nie. Uzyj fireBug'a do spardzania błędów JS'a w konsoli ![]() -------------------- |
|
|
![]()
Post
#5
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 1.06.2009 Ostrzeżenie: (0%) ![]() ![]() |
Probowalem tak jak napisaliscie , niestety dalej nie chce dzialac.. Firebug - nie umiem tego obsluzyc. Nie ukrywam , ze leze jesli chodzi o JS i PHP , stad tez wlasnie tutaj napisalem problem.
Jesli chodzi o "onClick"i , to sa one z gotowych skryptow - nie pisalem ich sam Ten post edytował Cog 2.06.2009, 16:55:40 |
|
|
![]()
Post
#6
|
|
![]() Grupa: Zarejestrowani Postów: 6 476 Pomógł: 1306 Dołączył: 6.08.2006 Skąd: Kraków Ostrzeżenie: (0%) ![]() ![]() |
Pokaż jak próbowałeś.
|
|
|
![]()
Post
#7
|
|
Grupa: Zarejestrowani Postów: 7 Pomógł: 0 Dołączył: 1.06.2009 Ostrzeżenie: (0%) ![]() ![]() |
CODE <input type="checkbox" name="box2" onClick="document.getElementById('Rasyproste').style.display = this.checked ? 'block' : 'none'; this.form.elements['nazwa2'].disabled = this.form.elements['nazwa3'].disabled = !this.checked; countChoices(this)">Section 2 Jeszcze tak: CODE <input type="checkbox" name="box2" onClick="document.getElementById('Rasyproste').style.display = this.checked ? 'block' : 'none'; this.form.elements['nazwa2'].disabled = this.form.elements['nazwa3'].disabled = !this.checked" onClick="countChoices(this)">Section 2 Edit: Dzieki wam za pomoc. Juz sobie poradzilem ![]() Ten post edytował Cog 2.06.2009, 22:25:33 |
|
|
![]() ![]() |
![]() |
Wersja Lo-Fi | Aktualny czas: 18.07.2025 - 00:48 |