Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
Applying style to a variable
K Robert
Ranch Hand
Posts: 116
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Sheriff
Posts: 67746
173
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
What does it mean to apply a style to a
variable
?
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
K Robert
Ranch Hand
Posts: 116
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 15385
6
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 116
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I use innerHTML this way:
name.innerHTML = arTest[i];
; but I am not sure how to add the formatting to it.
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In other words, the style gets applied to the element that you set the data within, not the variable.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
Eric Pascarello
author
Posts: 15385
6
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You know how to do it with normal HTML? If you do, buyild up a string that looks like that.
Eric
I’m tired of walking, and will rest for a minute and grow some wheels. This is the promise of this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
A simple editor with rich text in Android
Highlight the search keyword
Styling in Swing
CSS Inheritance
Simple CSS puzzle?
More...