forked from extern/egroupware
added function to set a style property in a given element-type and css-class
This commit is contained in:
parent
9f0f20a4cf
commit
edbb4bfa9c
@ -151,3 +151,27 @@ function values2url(form,names)
|
||||
//alert('url='+url);
|
||||
return url+'&etemplate_exec_id='+form['etemplate_exec_id'].value;
|
||||
}
|
||||
|
||||
// sets value (v) of style property (p) for all given elements of type (t) and class (c)
|
||||
// eg. set_style_by_class('td','hide','visibility','visible')
|
||||
function set_style_by_class(t,c,p,v)
|
||||
{
|
||||
//alert('set_style_by_class('+t+','+c+','+p+','+v+')');
|
||||
var elements;
|
||||
if(t == '*') {
|
||||
// '*' not supported by IE/Win 5.5 and below
|
||||
elements = (document.all) ? document.all : document.getElementsByTagName('*');
|
||||
} else {
|
||||
elements = document.getElementsByTagName(t);
|
||||
}
|
||||
for(var i = 0; i < elements.length; i++){
|
||||
var node = elements.item(i);
|
||||
for(var j = 0; j < node.attributes.length; j++) {
|
||||
if(node.attributes.item(j).nodeName == 'class') {
|
||||
if(node.attributes.item(j).nodeValue == c) {
|
||||
eval('node.style.' + p + " = '" +v + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user