dcsimg
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: JavaScript
Expertise: Intermediate
Dec 16, 2008

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Changing the Style of a String in JavaScript

JavaScript's String object provides functions that display style of the text:
  1. big()
  2. blink()
  3. bold()
  4. fixed()
  5. fontsize(<size>): This function takes a parameter to specify the font-size in pixels.
  6. fontcolor("<color>"): This function takes a string parameter to specify font-color.
  7. italics()
  8. link(""): This function takes a string parameter to specify the URL.
  9. small()
  10. strike()
  11. sub()
  12. sup()
  13. toLowercase()
  14. toUppercase()
For example, to display selected text in italics:

var text = "Hi there!"
document.write(text.italics()) 
//writes the string in italics
To set a link to a text:

document.write(text.link("http://www.devx.com")) 
//writes a hyperlinked string text
Deepak Choudhari
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date