Hello,
I am trying to use javascript to replace colors in css classes with hex values from a color selector (jscolor). It's working for basic classes and ids, but the stylesheet I need to work with contains contextual CSS and pseudo-classes and I can't figure out how to reference them. (The stylesheet I'm working with is pre-defined and I can't change it.)
The jscolor input field:
Code:<input class="color" onchange="updateText(this.color.toString())" />
The function:
Code:function updateText(color) { document.getElementsByClass('myClassName')[0].style.color = '#'+color }
Like I said, this works fine with simple classes. But I don't know how to get Javascript to replace the colors with the CSS I have to work with:
How do I reference these? I don't know Javascript that well, I'm just a prototyper -- and I'm stumped!Code:.ymp-color-text-main:link { color:#0075b9; } #ymp-tray ul li a.playing { background-color:#d4d4d4; color: #0075b9; } #ymp-tray ul li a:hover, #ymp-tray ul li a.ymp-tray-track-focus { background-color:#555555; color:#FFFFFF; }


Reply With Quote
Bookmarks