venerdì, marzo 09, 2007

HTML DOM Favorites

None of these are revolutionary, and all of them arbitrary, but I find myself looking these items up all the time and thus add them here for posterity:

Is a checkbox checked?
If (document.formname.checkboxname.checked == false)

Show/hide DIV
document.getElementById(‘divname’).style.display='none';
document.getElementById('divname').style.display='block';

Show/hide parent DIV from iframe

parent.document.getElementById("divname").style.display = "none";
parent.document.getElementById("divname").style.display = "block";

Show/hide iframe DIV from parent
document.iframename.document.getElementById("divname").style.display = "none";
document.iframename.document.getElementById("divname").style.display = "block";