![]() Benjamin Kitt |
![]() ![]()
This document
|
![]()
May 20, 1997 If you're looking to use dynamic HTML to spice up your web page with some Dynamic HTML, you could certainly do worse than using the onmouseover and onmouseout events. The onmouseover event is triggered when the user moves the mouse over an object, and the onmouseout event is triggered when a user moves the mouse outside of the object.
An object is defined using ID. For instance, we could set a certain font flag to have the ID of FONT1 by using the code:
<FONT ID="FONT1">
Once an object has its ID, we can then use that in a script to change the features of that object. I'll start off with a simple example. Lets start by making some text change color when we move over it. To do this, we'll need to create a normal page with a script at the top, and some text which is defined by a font flag. For instance:
When you've finished that page, you get something like this:
This text will change red when I move over it
The above text, if you have Internet Explorer Version 4, will change color when you move your mouse over it It is possible to do this with any text you want, but bear in mind you should never have more than one object named the same thing.
I'm going to become a little more adventurous now and do the same colour changing thing with links. The script is a little different now, but not much. We'll also get the status bar at the bottom of the browser to display a little bit of information about the link when the user moves over it. Here's the script you would use:
Once you've done that, you get something like this:
A link to Ben's Homepage
You can change the ID's, the links and the colors to suit your needs. That pretty much concludes todays lesson. Try playing about with the scripts and seeing what else you can get to change. You can change anything that has an ID. You could make a script, for instance, which would allow people to choose what width they would like their Horizontal Rulers to be! Give it a go, and if you need any help, you can mail me or post a message here on the HTML page asking me. If you want some more examples of Dynamic HTML, you can visit my page at the link above which contains some extra dynamic HTML, or visit the Site Builder Network which you'll find as one of the links to the right.
If you create a cool DHTML page, mail me the URL, I'd love to see them. Who know...you may even get a link :)
See ya until next time :)
Ben
|
![]()
Sitebuilder Network
Beginner's guide to HTML
Web Page Design
Guide to HTML
Hotdog Web Page Creator
|