HTML
  Home arrow HTML arrow Page 3 - Custom Buttons in HTML
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 
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? 
HTML

Custom Buttons in HTML
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2008-05-07

    Table of Contents:
  • Custom Buttons in HTML
  • Colored Button
  • Colored Button continued
  • Button with Background Image

  • 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


    Custom Buttons in HTML - Colored Button continued


    (Page 3 of 4 )

    You would normally have more than one button where you want these same effects. The following code shows the complete code for two buttons, having the above effects:


    <html>


    <head>

    <style type="text/CSS">

    button {background-color:rgb(186,85,211);

    border-style:solid;

    border-left-color:rgb(238,130,238);

    border-top-color:rgb(238,130,238);

    border-right-color:rgb(128,0,128);

    border-bottom-color:rgb(128,0,128);

    color:rgb(250,250,226)

    }

    </style>

    <script type="text/JavaScript">

    function showPressed(ID)

    {

    document.getElementById(ID).style.borderLeftColor = "rgb(128,0,128)";

    document.getElementById(ID).style.borderTopColor = "rgb(128,0,128)";

    document.getElementById(ID).style.borderRightColor = "rgb(238,130,238)";

    document.getElementById(ID).style.borderBottomColor = "rgb(238,130,238)";

    }

    function unPressed(ID)

    {

    document.getElementById(ID).style.borderLeftColor = "rgb(238,130,238)";

    document.getElementById(ID).style.borderTopColor = "rgb(238,130,238)";

    document.getElementById(ID).style.borderRightColor = "rgb(128,0,128)";

    document.getElementById(ID).style.borderBottomColor = "rgb(128,0,128)";

    }

    </script>

    </head>


    <body>

    <button type="button" id="B1" onmousedown="showPressed('B1')" onmouseup="unPressed('B1')"><b>Click Me</b></Button> &nbsp

    <button type="button" id="B2" onmousedown="showPressed('B2')" onmouseup="unPressed('B2')"><b>Also Me</b></button>

    </body>


    </html>


    When an event is triggered, a function is called with the ID of the button, passed as an argument. The JavaScript functions take the ID as an argument.

    More HTML Articles
    More By Chrysanthus Forcha


       · It is cool.Chrys
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







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