aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Applying style to a variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Applying style to a variable" Watch "Applying style to a variable" New topic
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
    
  13

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
    
    6
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
    
  13

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
    
    6
You know how to do it with normal HTML? If you do, buyild up a string that looks like that.

Eric
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Applying style to a variable
 
Similar Threads
Styling in Swing
Highlight the search keyword
A simple editor with rich text in Android
CSS Inheritance
Simple CSS puzzle?