| Author |
Applying style to a variable
|
K Robert
Ranch Hand
Joined: May 16, 2003
Posts: 116
|
|
|
I want to apply several styles to a javascript variable:font, size, color, etc. How do I apply all the styles to one variable?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
What does it mean to apply a style to a variable?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
K Robert
Ranch Hand
Joined: May 16, 2003
Posts: 116
|
|
Sorry for the lack of info. Basically, I have an app that is returning a value to be displayed on a html page. I want to apply formatting directly to that value.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
well you would have to add it either building a string and using innerHTML or using dom methods with createElement and setAttribute() Eric
|
 |
K Robert
Ranch Hand
Joined: May 16, 2003
Posts: 116
|
|
|
I use innerHTML this way: ; but I am not sure how to add the formatting to it.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56150
|
|
|
In other words, the style gets applied to the element that you set the data within, not the variable.
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You know how to do it with normal HTML? If you do, buyild up a string that looks like that. Eric
|
 |
 |
|
|
subject: Applying style to a variable
|
|
|