The code or a link to the page would be good if you cannot take the info that follows here and run with it.
Basically you have an element, hopefully a division, with this extra content in it. This element should have an id. And the checkbox associated with it should also have an id or some way of uniquely identifying it on the page. So lest's say you have all that, and a means to show and hide the division or whatever it is (from here on I'll call it the div). That would be a function - say showHide(), that takes the div as a parameter and 'show' or 'hide' as the second parameter. You may have two functions, one to show, one to hide, whatever you have may have a different name. But this shows the general concept:
Code:
;(function(){
var boxes = [document.getElementById('box1'), document.getElementById('box2')],
content = [document.getElementById('box1content'), document.getElementById('box2content')];
function getBoxes(){
for (var i = boxes.length - 1; i > -1; --i){
if(box[i].checked){
showHide(content[i], 'show');
}
}
}
if (window.addEventListener){
window.addEventListener('load', getBoxes, false);
}
else if (window.attachEvent){
window.attachEvent('onload', getBoxes);
}
})();
Bookmarks