JavaScript
  Home arrow JavaScript arrow Page 3 - Creating Different Push Buttons with the Y...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

Creating Different Push Buttons with the Yahoo Button Control
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 3
    2007-12-04

    Table of Contents:
  • Creating Different Push Buttons with the Yahoo Button Control
  • A review: building radio buttons and checkboxes with the Yahoo! Button Control
  • Extending the Use of Control Buttons
  • Building push buttons using predefined button control HTML

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating Different Push Buttons with the Yahoo Button Control - Extending the Use of Control Buttons


    (Page 3 of 4 )

    As I explained in the section that you just read, the handy Yahoo! Button Control allows you to easily build different types of buttons. In this case, I’m going to demonstrate how to create one in particular, called “push,” which, as its name suggests, behaves like a conventional web form button. It’s not linked by default to any specified URL, unless this is done by using the respective <a> tag.

    Now that I have explained how a “push” button works, please take a look at the signature of the following hands-on example, which shows how to build this kind of widget by using two existing <input type=”button”> tags. 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">

    <html xmlns="http://www.w3.org/1999/xhtml">

      <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-
    8859-1" />

    <title>Example of "push" Yahoo Button using input
    type=button</title>

    <!-- Include core + Skin CSS files-->

    <link rel="stylesheet" type="text/css"
    href="build/button/assets/skins/sam/button.css">

    <!-- This file is optional: Menu Stylesheet (required for
    creating buttons of type "menu" and "split") -->

    <link rel="stylesheet" type="text/css"
    href="build/menu/assets/skins/sam/menu.css">

    <!-- Include dependencies -->

    <script type="text/javascript" src="build/yahoo-dom-event/yahoo-
    dom-event.js"></script>

    <script type="text/javascript" src="build/element/element-beta-
    min.js"></script>

    <!-- This file is optional: Menu and Container Core (required for
    creating buttons of type "menu" and "split") -->

    <script type="text/javascript"
    src="build/container/container_core-min.js"></script>

    <script type="text/javascript" src="build/menu/menu-
    min.js"></script>

    <!-- Source file -->

    <script type="text/javascript" src="build/button/button-beta-
    min.js"></script>

    </head>

      <body class="yui-skin-sam">

    <input type="button" id="pushbutton1" name="button1" value="Push
    Button 1">

    <input type="button" id="pushbutton2" name="button2" value="Push
    Button 2">

     <script type="text/javascript">

       var sPushButton1 = new YAHOO.widget.Button("pushbutton1");

       var sPushButton2 = new YAHOO.widget.Button("pushbutton2");

    </script>

    </body>

    </html>

    As you can see, the above example illustrates how to build a pair of “push” buttons” by using two existing “<input type=”button”> tags and the familiar “YAHOO.widget.Button” class that you saw in previous articles of the series. Not too difficult to grasp, right?

    And finally, here’s an additional screen shot that shows more clearly the look and feel of the “push” buttons just created:

    All right, at this point I think that you should have a solid background on how to build “push” buttons by using the neat Yahoo! Button Control along with a few simple “<input type=”button”> tags. However, I’d like to expand a bit more on  how to build these widgets. Thus, in the last section of this tutorial I’ll show you yet another practical example, aimed at creating the buttons in question, but this time by using a predefined CSS class bundled with the Yahoo UI library, called “yui-push-button”.

    To see how this brand new hands-on example will be developed, please jump ahead and read the next few lines.

    More JavaScript Articles
    More By Alejandro Gervasio


       · Over the course of this third chapter of the series, you’ll see how to build...
     

    JAVASCRIPT ARTICLES

    - More on JavaScript Array Objects
    - Methods of the DOM Location Object
    - The DOM Location Object Properties
    - Handling Remote Files with JavaScript Click ...
    - Using Click Interceptions with a Database-Dr...
    - Using JavaScript Click Interceptions in an I...
    - Using Click Interceptions with JavaScript
    - QuickSort in Action
    - Quicksort
    - Using Mod_Security to Protect Your Server
    - Detecting and Countering Server Intrusions
    - Securing Your Web Server
    - Building a Secure Web Server
    - Protecting the Server
    - Book Review: Learning the Yahoo! User Interf...


     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT