Výsledky 1 až 5 z 5

Téma: [JavaScript] Mozilla/Firefox bug ???

  1. #1
    Terorista karabínový mince Avatar uživatele PiT
    Založen
    13.09.2002
    Bydliště
    Bratislava
    Příspěvky
    4 550
    Vliv
    300

    Standardní [JavaScript] Mozilla/Firefox bug ???

    Mam standardny
    Kód:
    <input type="text" class="definovanyCSS" name="pole&#91;cislo&#93;" value="nejakytext" onChange="document.getElementById&#40;'pole&#91;cislo&#93;'&#41;.style.color='red'">
    (definovanyCSS ma font, velkost fontu, farbu fontu a farbu pozadia..)

    Chcem docielit to, ze po zmene textoveho pola, sa mi zmeni farba pisma (napr. z ciernej na cervenu - aby clovek videl, co zmenil...)

    Problem/haluz je ta, ze ak pouzijem nestandardne document.all('pole[cislo]').style.color='red', vsetko funguje...

    Ak pouzijem document.getElementByIdl('pole[cislo]').style.color='red', tak to v IE ide a Firefox mi vypiskuje:

    Citace Původně odeslal Firefox JavaScript Console
    Error: document.getElementById("pole[cislo]") has no properties
    So WTF
    And down we go again, under the relentless wawes, into the arms of calm breakers, into bayou of forgotten dreams
    Like sand slipping through my fingers, nothing ever lasts, ever will

  2. #2
    Senior Member minceVIP Avatar uživatele sisi
    Založen
    24.02.2003
    Bydliště
    Auckland, NZ
    Příspěvky
    2 176
    Vliv
    294

    Standardní

    Je to OK... v tom dokumente (zrejme) naozaj nemas ziaden element s tym danym id (= runtime error pri referencovani property null objektu). K tomu text input elementu sa musis dopracovat cez metodu document.getElementsByName(...).
    Intel Core 2 Duo E6600 @ 3.2GHz (8 * 400MHz) @ 1.3V with Zalman CNPS9500 AT @ 1800RPM, ASUS P5B Deluxe/WiFi, 2x1GB Corsair Twin2X PC2-6400 DDRAM @ 400MHz (4-4-4-12) @ 2.1V, Leadtek 8800GT 512MB, WD Caviar SE16 250GB, Asus DRW-1608P3S, Creative SB Audigy Value, Logitech X-230 speakers, Enermax Liberty 400W, 2x120mm Thermaltake case fan @ 1800RPM, Thermaltake Aguila black case, HP LP2065 LCD, Logitech MX400

  3. #3
    Terorista karabínový mince Avatar uživatele PiT
    Založen
    13.09.2002
    Bydliště
    Bratislava
    Příspěvky
    4 550
    Vliv
    300

    Standardní

    Uz som to skusal... Vracia to tu istu chybu...

    Citace Původně odeslal Firefox JavaScript Console
    Error: document.getElementsByName("pole[cislo]").style has no properties
    A teraz babo rad...
    And down we go again, under the relentless wawes, into the arms of calm breakers, into bayou of forgotten dreams
    Like sand slipping through my fingers, nothing ever lasts, ever will

  4. #4
    Senior Member minceVIP Avatar uživatele sisi
    Založen
    24.02.2003
    Bydliště
    Auckland, NZ
    Příspěvky
    2 176
    Vliv
    294

    Standardní

    Ehm, no, ona ta metoda vracia pole/collection elementov... Ty si z nej musis vybrat ten "pravy". Ak v tom celom dokumente mas len jeden element s danym name, potom je to jednoduche... staci zobrat document.getElementsByName(name)[0].
    Intel Core 2 Duo E6600 @ 3.2GHz (8 * 400MHz) @ 1.3V with Zalman CNPS9500 AT @ 1800RPM, ASUS P5B Deluxe/WiFi, 2x1GB Corsair Twin2X PC2-6400 DDRAM @ 400MHz (4-4-4-12) @ 2.1V, Leadtek 8800GT 512MB, WD Caviar SE16 250GB, Asus DRW-1608P3S, Creative SB Audigy Value, Logitech X-230 speakers, Enermax Liberty 400W, 2x120mm Thermaltake case fan @ 1800RPM, Thermaltake Aguila black case, HP LP2065 LCD, Logitech MX400

  5. #5
    Terorista karabínový mince Avatar uživatele PiT
    Založen
    13.09.2002
    Bydliště
    Bratislava
    Příspěvky
    4 550
    Vliv
    300

    Standardní

    Vdaka
    And down we go again, under the relentless wawes, into the arms of calm breakers, into bayou of forgotten dreams
    Like sand slipping through my fingers, nothing ever lasts, ever will

Informace o tématu

Users Browsing this Thread

Toto téma si právě prohlíží 1 uživatelů. (0 registrovaných a 1 anonymních)

Pravidla přispívání

  • Nemůžete zakládat nová témata
  • Nemůžete zasílat odpovědi
  • Nemůžete přikládat přílohy
  • Nemůžete upravovat své příspěvky
  •