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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
OpenOffice 3.2 Lands Amid Critical Changes
Red Hat, IBM Firmly in KVM Virtualization Camp
Red Hat Talks Up Open Source Cloud Plans

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:


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

webref The latest from WebReference.com Browse >
Are Google's Language Translation Web Services Ready for Prime Time? · Installing and Using Meeplace, the Business Review CMS · Sending an HTML and Plain Text E-newsletter with ASP.NET, Part 2
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Workers Say Telework Is More Productive, Bosses Not So Sure · Kingston Debuts Power-Saving Memory Upgrades · Social Networking is King: Facebook Edges Google