2013-10-22 13 views
16

mam trochę kodu JavaScript napisałem, iz jakiegoś powodu dostaję błąd mówiąc:Dlaczego otrzymuję komunikat "ReferenceError: getElementById nie jest zdefiniowany"?

ReferenceError: getElementById is not defined 

Oto funkcja:

window.onload=function() 
{ 
    clearAll(); 
    updatePizzaToppings(); 
    updatePizzaToppings(); 
    updatePizzaToppings(); 
    updatePizzaToppings(); 
}; 


function updatePizzaToppings() 
{ 
    var checkBox=getElementById('selectBacon'); 
    var pic=getElementById('BaconPic'); 
    if (checkBox.checked) 
    { 
     pic.style.visibility='visible'; 
    } 
    else 
    { 
     pic.style.visibility='hidden'; 
    }   
}; 

Zrobiłem trochę JSFiddle dla to także.

http://jsfiddle.net/CkjkB/5/

Odpowiedz

Powiązane problemy