If you've ever wanted a little help with the user interfaces for your web site, you might want to learn about the Yahoo Button Control. It comes from Yahoo's UI framework, and can help you to create an interactive and professional-looking front end for your web site. This article, the first one in a five-part series, gives you a taste of what you can do with it.
A Close Look at the Yahoo Button Control - Using an existing radio button (Page 3 of 4 )
As I expressed in the previous section, Yahoo! Button Controls are extremely versatile, since they can be easily built not only by using an <input type=”button”> tag, but by coding other web form elements as well.
To demonstrate more clearly the previous concept, below I coded a brand new hands-on example, which illustrates how to include a simple Button Control by using an “<input type=”radio”> tag.
The corresponding code sample is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
As shown by the previous example, it’s extremely easy to include a basic Button Control utilizing different web form elements. As you can see, I utilized a radio button to build the control in question, whose ID is also passed as an input argument to the pertinent YAHOO.widget.Button class.
The result of this process is shown by the image below:
So far, so good, right? At this point you hopefully grasped the underlying logic required to include a simple Yahoo! Button control into any web document, since the whole process is indeed very easy to follow. However, I’d like to provide you with yet another example of how to create this type of control. This time we'll use a basic checkbox, in this way completing this practical demonstration of building Button Controls from existing (X)HTML markup.
To see how this final example will be developed, please go ahead and read the new few lines.