Adding universally useful functions to the mainstream.

This commit is contained in:
defacer
2005-03-18 14:36:10 +00:00
parent 3f1f367d04
commit 363cb62cf1
+27
View File
@@ -69,3 +69,30 @@ function submitFormById(id) {
return theform.submit();
}
}
function select_all_in(elTagName, elId, elClass) {
var inputs = document.getElementsByTagName('INPUT');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elId, elClass);});
for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'checkbox') {
inputs[i].checked = 'checked';
}
}
}
function deselect_all_in(elTagName, elId, elClass) {
var inputs = document.getElementsByTagName('INPUT');
inputs = filterByParent(inputs, function(el) {return findParentNode(el, elTagName, elId, elClass);});
for(var i = 0; i < inputs.length; ++i) {
if(inputs[i].type == 'checkbox') {
inputs[i].checked = '';
}
}
}
function confirm_if(expr, message) {
if(!expr) {
return true;
}
return confirm(message);
}