function selectall(checkbox) { if(!checkbox) // page does not have any checkbox return; else if(!checkbox.length) // page has only one checkbox checkbox.checked = !checkbox.checked; else { for(var i=0; i