spacer
Yehuda Shiran August 18, 2000
Changing Inline Colors
Tips: August 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

One way to modify an element's appearance on the page is to set its style object's properties. For example, the following element changes its color to tan when moused over:

Mouse over me to see my over color. Then mouse out to see my out color.

<H1 onMouseOver="this.style.color = 'tan';"
 onMouseOut="this.style.color = 'purple';">Mouse over me to see my over color. 
 Then mouse out to see my out color.</H1>

Notice that the text has three colors. The first color is the default color (black) which is being used upon loading (and reloading) of the page. The other two colors ("purple" and "tan") are set by the onMouseOver() and onMouseOut() events.

Learn more about the subject in Column 66, Dynamic Styles.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint