Text Mouse Rollovers


Styles can be changed dynamically, and that's where JavaScript comes in. We've seen, for example, that you can change the style of text when the mouse rolls over it. Here's Listing 16-02.htmland now we know how this works (dynamic styles such as this won't work in Netscape Navigator before version 6.):

 <HTML>      <HEAD>          <TITLE>              Text Mouse Rollovers          </TITLE>      </HEAD>      <BODY>          <CENTER>              <H1>                  Text Mouse Rollovers              </H1>  <SPAN ONMOUSEOVER="this.style.fontSize='48'"   ONMOUSEOUT="this.style.fontSize='12'"   STYLE="fontSize:36">   This text gets big when the mouse is over it.   </SPAN>  </CENTER>      </BODY>  </HTML> 

You also can change other style properties when the mouse rolls over text, such as the color of that text as in this case, where we're changing the text color to red:

 <HTML>      <HEAD>          <TITLE>              Text Mouse Rollovers          </TITLE>       </HEAD>      <BODY>          <CENTER>              <H1>                  Text Mouse Rollovers              </H1>  <SPAN ONMOUSEOVER="this.style.color='red'"   ONMOUSEOUT="this.style.color='black'">   This text changes color when the mouse is over it.   </SPAN>  </CENTER>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net