Okay, I'll try to explain this as simply as possible. I want to, dynamically, most likely with a javascript function, change the properties of a CSS style. Currently, I've crafted some code that will allow me to change/apply a style to a specific DIV -- targeting the ID of it. This is great...
Here is a sample of the code:
<style type="text/css">
<!--
.theStyle {
width: 150px;
height: 150px;
visibility: hidden;
background-color:#CCCCCC;
}
-->
</style>
<script language="JavaScript">
function makeVis(divID) {
document.getElementById(divID).style.visibility = "visible";
}
</script>
<div id="theDivNameOne" class="theStyle" align="center"> The First Div </div>
<div id="theDivNameTwo" class="theStyle" align="center"> The Second Div </div>
<a href="javascript:makeVis('theDivNameOne');">Make One Visible</a> | <a href="javascript:makeVis('theDivNameTwo');">Make Two Visible</a>
When I click 'Make One Visible' it will make 'theDivNameOne' show up. The second will stay hidden. And the same works with 'Make Two Visible'.
Now here comes the part I can't figure out.
I want to change the style by targetting the actual style/class that is specified in the CSS code -- not by targetting the actual DIV. So if I could do something like:
<a href="javascript:makeVis('theStyle');">Make Them ALL Visible</a>
Any DIV, SPAN, P or anything that has 'class="theStyle"' applied to it, will change... It actually changes the class/style rather than changing the class/style of a specific item.
Any ideas?