/    Sign up×
Community /Pin to ProfileBookmark

Dynamically update class style?

Hi,

I’m looking for a modification that can dynamically update the background color of all instances of a class on a page.

I am currently using the [url=http://jscolor.com/]JSColor[/url] script, but unfortunately that is restricted to updating the background color of a single instance of an ID only, rather than multiple instances of an ID or multiple instances of a class.

Can anyone find/create a suitable script that can accomplish what I mentioned, or else modify the JSColor script to do so?

Thanks very much.

to post a comment
JavaScript

14 Comments(s)

Copy linkTweet thisAlerts:
@KorNov 09.2011 —  multiple instances of an ID [/QUOTE]
That is illegal in HTML/CSS and javaScript. A certain id must be [I]unique[/I] on document.

Now, for all the browsers (except for IE < IE9) there is a simple method to refer all the elements with the same class: [B]document.getElementsByClassName()[/B]

For IE7 and IE8, you may add this workaround:
<i>
</i>function setClassMethod(){
if (!document.getElementsByClassName) {
document.getElementsByClassName = function (cn) {
var rx = new RegExp("(?:^|\s)" + cn+ "(?:$|\s)");
var allT = document.getElementsByTagName("*"), allCN = [], ac="", i = 0, a;
while (a = allT[i=i+1]) {
ac=a.className;
if ( ac &amp;&amp; ac.indexOf(cn) !==-1) {
if(ac===cn){ allCN[allCN.length] = a; continue; }
rx.test(ac) ? (allCN[allCN.length] = a) : 0;
}
}
return allCN;
}
}
}

onload=function(){
setClassMethod();
}


Could be simpler crossbrowser ways, but that depends on the exact structure of your DOM and HTML code.
Copy linkTweet thisAlerts:
@bbsauthorNov 09.2011 — 
Now, for all the browsers (except for IE < IE9) there is a simple method to refer all the elements with the same class: [B]document.getElementsByClassName()[/B]
[/QUOTE]


I tried using that in place of document.getElementById in the JSColor script, but it didn't seem to be enough; the background color(s) generated by the script did not appear for the specified class.

I contacted the script author, who suggested that simply replacing getElementById with getElementsByClassName would not be enough, and further modification of the script would be needed, although he didn't provide further tips.
Copy linkTweet thisAlerts:
@bbsauthorNov 09.2011 — [b]Calling all JavaScript coders! Can anyone modify the JSColor script below to allow a user to update the background color for multiple instances of a class rather than just a single ID instance?[/b]

Please see the three blocks of code below. You can also check out a live example of the script [url=http://jscolor.com/example01.php]here[/url]

(1/3) Here's the input to add to the HTML to allow a user to change a color of some instance:
<i>
</i>&lt;input class="color" name="bgColor" style="position:absolute; top:10px; right:10px" onchange="updateBackground(this.color.toString())" value="666666" /&gt;


(2/3) Here's the main part of the JSColor script:

http://jscolor.com/jscolor/jscolor.js

(3/3) And finally here is what updates the background color:
<i>
</i>&lt;script type="text/javascript"&gt;&lt;!--
/*&lt;![CDATA[*/
function updateBackground(color) {
document.getElementsByTagName('body')[0].style.backgroundColor = '#'+color
}
--&gt;&lt;/script&gt;
Copy linkTweet thisAlerts:
@KorNov 09.2011 — Yes. getElementById() refers a single element with a certain id (as the id must be unique), while getElementsByClassName() refers a collection of elements (something like an Array).

Now, my question is: do you know JavaScript? If not, you should learn it before anything else.
Copy linkTweet thisAlerts:
@bbsauthorNov 09.2011 — Yes. getElementById() refers a single element with a certain id (as the id must be unique), while getElementsByClassName() refers a collection of elements (something like an Array).[/quote]

I know, so I'm guessing further modification to the JSColor script would be necessary. Can you help?

Now, my question is: do you know JavaScript? If not, you should learn it before anything else.[/QUOTE]

No, and I do not currently have time to learn, which is why I'm asking here.
Copy linkTweet thisAlerts:
@KorNov 09.2011 — Here's a color palette I have made several years ago... maybe it will be of some help:
<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Color picker&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
&lt;meta http-equiv="Content-Script-Type" content="text/javascript"&gt;
&lt;script type="text/javascript"&gt;
//Color picker
//For safe (216) web colors
//Genuine code 2006 by Corneliu Lucian "Kor" Rusu corneliulucian[at]gmail[dot].com
onload = function(){
var cel = document.getElementById('tab').getElementsByTagName('td');
var R=0;var G=0;var B=0;
for(var i=0;i&lt;cel.length;i++){
cel[i].style.backgroundColor='rgb('+R+','+G+','+B+')';
cel[i].r=(R!=0)?R.toString(16):R.toString(16)+R.toString(16);
cel[i].g=(G!=0)?G.toString(16):G.toString(16)+G.toString(16);
cel[i].b=(B!=0)?B.toString(16):B.toString(16)+B.toString(16);
cel[i].onclick=function(){
document.getElementById('inp').value='#'+this.r+this.g+this.b;
//optional, the below line sets the document's background color as well
document.getElementsByTagName('body')[0].style.backgroundColor='#'+this.r+this.g+this.b;
}
G+=51;if(G&gt;255){G=0;R+=51;if(R&gt;255){R=0;B+=51;}}}
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table id="tab" width="363" border="1" cellpadding="0" cellspacing="1" bordercolor="#666633"&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt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nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;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td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;td&gt;&amp;nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;br&gt;
&lt;br&gt;
&lt;input id="inp" type="text"&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@KorNov 09.2011 — 
No, and I do not currently have time to learn[/QUOTE]

Hm... Web developing and programming is a [I]real profession[/I], did you know that? To work in this domain, you have to learn the languages. If you have no time to learn, simply quit and get yourself a job in another domain, where you had time to learn. :rolleyes:
Copy linkTweet thisAlerts:
@bbsauthorNov 09.2011 — Hm... Web developing and programming is a [I]real profession[/I], did you know that? To work in this domain, you have to learn the languages. If you have no time to learn, simply quit and get yourself a job in another domain, where you had time to learn. :rolleyes:[/QUOTE]

Who said I am working in this domain? I'm simply looking for a quick fix for a website, and thought that this place would be full of experts that would be good to ask. It seems like some people are more intent on telling others to learn something to resolve an issue than demonstrate they can solve it themselves. Come on, if you know JavaScript well enough to warrant mocking someone who has an issue like mine, then surely you would be able to figure out a solution? I'll pay you some quick cash via PayPal if you can.
Copy linkTweet thisAlerts:
@KorNov 09.2011 — It seems like some people are more intent on telling others to learn something to resolve an issue than demonstrate they can solve it themselves.
[/QUOTE]

Correct. But you have already said you have no time to learn, so what else can I do? It is impossible for me to show you how to fix [I]yourself[/I] a problem, or to give you a clue (by the way, I still have offered you not one, but two solutions) as long as we do not speak the same language?

Come on, if you know JavaScript well enough to warrant mocking someone who has an issue like mine, then surely you would be able to figure out a solution?
[/quote]

I am not here to solve your problems, I am here to help [i]you[/I] to solve yourself the problems, and this is a big difference.

I'll pay you some quick cash via PayPal if you can.[/QUOTE]

No, thanks. If you want to hire somebody or to pay for a freelancer job, post a Thread in our Forum: Available Positions
Copy linkTweet thisAlerts:
@bbsauthorNov 09.2011 — Hooray! I incorporated the following at http://www.twelvestone.com/conversations/change-css-class-style-with-javascript and it worked:

<i>
</i>function changeRule(theNumber) {
var theRules = new Array();
if (document.styleSheets[0].cssRules) {
theRules = document.styleSheets[0].cssRules;
}
else if (document.styleSheets[0].rules) {
theRules = document.styleSheets[0].rules;
}
theRules[theNumber].style.backgroundColor = '#FF0000';
}


I modified it slightly to work with JSColor (theNumber refers to the CSS rule #) (this replaces the JS content in block 3/3 in [url=http://www.webdeveloper.com/forum/showpost.php?p=1179181&postcount=4]my post above[/url]):
<i>
</i>function changeRule(theNumber,color) {
var theRules = new Array();
if (document.styleSheets[0].cssRules) {
theRules = document.styleSheets[0].cssRules;
}
else if (document.styleSheets[0].rules) {
theRules = document.styleSheets[0].rules;
}
theRules[theNumber].style.backgroundColor = '#'+color;
}
Copy linkTweet thisAlerts:
@KorNov 10.2011 — You see? You were pessimist when you said you know nothing about JavaScript, nor you have time to learn. It looks like you understand the basics of the language and you found some time to learn a little bit. That, I assure you, will help you much for the future. ?
Copy linkTweet thisAlerts:
@bbsauthorNov 10.2011 — I had to make a few other modifications to store cookies for color changes (more like "modified incorporations" at this point), and it's still undergoing work, but the harder parts are solved.

I did take two Java courses a few years ago, but did not go past an intermediate level at that time, although I guess it still helped me somewhat since Java and JavaScript seem relatively similar in many respects.
Copy linkTweet thisAlerts:
@KorNov 10.2011 — Java and JavaScript seem relatively similar in many respects.

But yeah, I didn't really have time lately to get too deep into it.[/QUOTE]

Java and JavaScript seem relatively similar [I]in very few aspects[/I]. It is just a resemblance of name, due to a trade mark decision at that time (the alliance between Netscape and Java in the 90's). But, yes, once you have learned at least the basis of an Object Oriented language, any other OO language is easier to be understood.

The main difference between JavaScript and Java is that JavaScript is a scripting, run-timed, prototype-based metalanguage, while Java is a compiled, class-based language. Anyway... ?
Copy linkTweet thisAlerts:
@bbsauthorNov 10.2011 — Yeah, sorry, I meant to update my post to say "some aspects" instead of "many aspects" since the latter [depending on interpretation] can seem to imply a majority among all aspects, even if that's not what was meant. I agree with you on Java and JavaScript being very different overall. ? Thanks for your support and comments.
×

Success!

Help @bbs spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...