2013-10-22 23 views
16

Ho un po 'di codice JavaScript che ho scritto, e per qualche motivo sto ottenendo un errore che dice:Perché sto ricevendo "ReferenceError: getElementById non definito"?

ReferenceError: getElementById is not defined 

Qui è la funzione:

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'; 
    }   
}; 

ho fatto un po' per JSFiddle anche così.

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

risposta

Problemi correlati