michaelmuller
Programmer
Hey all,
I'm trying to add some functionality to a web-based stylesheet editor. I'd like the style that the editor is working on to highlight the page area it will effect. This is what I have, but it only works on style IDs and not style CLASSes. How can I effect styles by class?
Thanks for any help in advance,
Michael
--------------------------
Snippet of the style sheet:
--------------------------
div.box_members { }
div.box_members div.content { color:#000000; background-color:#ace; }
--------------------------
The code:
--------------------------
onmouseover="javascript:hlLayer('div.box_members','3px dotted red;');"
--------------------------
The function:
--------------------------
function hlLayer(myStyle,what) {
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(myStyle).style;
style2.border = style2.border? "":what;
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[myStyle].style;
style2.border = style2.border? "":what;
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[myStyle].style;
style2.border = style2.border? "":what;
}
}
I'm trying to add some functionality to a web-based stylesheet editor. I'd like the style that the editor is working on to highlight the page area it will effect. This is what I have, but it only works on style IDs and not style CLASSes. How can I effect styles by class?
Thanks for any help in advance,
Michael
--------------------------
Snippet of the style sheet:
--------------------------
div.box_members { }
div.box_members div.content { color:#000000; background-color:#ace; }
--------------------------
The code:
--------------------------
onmouseover="javascript:hlLayer('div.box_members','3px dotted red;');"
--------------------------
The function:
--------------------------
function hlLayer(myStyle,what) {
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(myStyle).style;
style2.border = style2.border? "":what;
}
else if (document.all)
{
// this is the way old msie versions work
var style2 = document.all[myStyle].style;
style2.border = style2.border? "":what;
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[myStyle].style;
style2.border = style2.border? "":what;
}
}