Create An Html 40 Button

f you are working with a user that has a Web browser that supports the HTML 4.0 <button> element, you can use the HTMLButton control to create a button with some nice features. Note that the <button> element is defined in the HTML 4.0 specification;therefore, it is supported only in Microsoft Internet Explorer version 4.0 and above (Other popular browsers like Navigator and Opera, currently do not support the <button> element). With HTML 4.0, you can use some client-side events to customize the look, feel, and behavior of buttons.

An HTMLButton control needs to reside on an HTMLForm control within your page to fully utilize this control. As when adding other controls, give each of the

HTMLButton controls an id and set the runat attribute equal to Server.

You can use the two DHTML events, onMouseOver and onMouseOut, to set button properties. For example, you can change a button's background color whenever a user positions the mouse cursor over the button. This feature lets the user know that he or she can click the button. You can use the onMouseOver event to change the background color. To change the background color back to the original setting when the user moves the mouse cursor away from the button, use the onMouseOut event.

CREATE AN HTML 4.0 BUTTON

CREATE AN HTML 4.0 BUTTON

Q Open the

WelcomeTemplate.aspx template from the Code Templates directory.

< Set the STYLE attribute for the button.

-Q Set the background color of the button for the onMouseOver event.

0 Save the file and request it from the Web server.

■ The button background color changes.

_0 Click Continue and move the mouse off the button.

Q Open the

WelcomeTemplate.aspx template from the Code Templates directory.

Add a Continue button with the HTMLButton control to the form and call the Button_OnClick function for the onServerClick event.

< Set the STYLE attribute for the button.

-Q Set the background color of the button for the onMouseOver event.

-0 Set the background color for the button for the onMouseOut event.

0 Save the file and request it from the Web server.

Note: See pages 20 to 25 for instructions on saving a file to the Web server and requesting the file using the IIS Admin.

■ The button background color changes.

_0 Click Continue and move the mouse off the button.

-■ The button background color changes back.

-■ A continue message appears.

WORK WITH HTML CONTROLS

Was this article helpful?

0 0

Post a comment