[PLUG-Devel] Javascript variable value into class parameter?
Alan Dayley
alandd at consultpros.com
Wed Sep 2 11:41:31 MST 2009
I, embedded developer and Scrum Master, am attempting to write
javascript. Yes, the danger of error is high. However, your web
pages are safe since this is a page for a specific and internal-only
use.
I am creating a page to have an official clock for the engineering
team. Seems our meetings tend start a minute or two late. The
discussion always leads to something like "Does anyone really know
what time it is?" So I want to create the canonical answer to this
question!
I'm starting with this really cool "Cool Clock"
http://randomibis.com/coolclock/. By slapping it on a page, it's good
enough. Except, I want the clock to fill the screen of Firefox in
full screen mode. Being a good programmer (just not with javascript)
I want to solve the problem forever by making the page smart enough to
resize the clock for the page it's on.
The "class" parameter(?) has an argument to set the clock radius to a
specified number of pixels. I have javascript that gets the current
browser window size and determines what the radius should be. This
radius value is stored in a javascript variable "clocksize."
Now my problem: How do I get the value of this variable into the
"class" statement of the following line?
<canvas id="theclock" class="CoolClock:chunkySwissOnBlack:250"></canvas>
I want the 250 in the above to be replaced by the value of the
"clocksize" variable. Google searches give me all kinds of options
like "document.write" and so on but I need to get the value into the
string after the "class=" part of the canvas tag.
Any tips or solutions from this group?
Alan
More information about the PLUG-devel
mailing list