Button control based on layer : Button « Ajax Layer « JavaScript DHTML

JavaScript DHTML
1. Ajax Layer
2. Data Type
3. Date Time
4. Development
5. Document
6. Event
7. Event onMethod
8. Form Control
9. GUI Components
10. HTML
11. Javascript Collections
12. Javascript Objects
13. Language Basics
14. Node Operation
15. Object Oriented
16. Page Components
17. Security
18. Style Layout
19. Table
20. Utilities
21. Window Browser
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
JavaScript DHTML » Ajax Layer » Button 
Button control based on layer


http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - Button</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
  dynapi.library.setPath('./dynapisrc/');
  dynapi.library.include('dynapi.api');
  dynapi.library.include('dynapi.gui.BorderManager');
  dynapi.library.include('Button');
  dynapi.library.include('ButtonFlatStyle'); // (optional)
  dynapi.library.include('ButtonImageStyle'); // (optional)
</script>
<script language="Javascript">

// Set BlueGel Image Path
// Styles.setImagePath('./dynapiexamples/images/bluegel/');

// Make all buttons use the Flat Style
//Styles.addStyle('Button',FlatButtonStyle);

//var btnStyle = Styles.getStyle('ButtonFlat');
//btnStyle.setStyleAttribute('backColor','#C0C0C0'); // set global style atribute

var btn = new Button('B',300,100,20,20);
var btn2 = new Button('Flat Button 2',300,170,100,30,'ButtonFlat');
var btn3 = new Button('I2',300,130,21,21,'ButtonImage');
dynapi.document.addChild(btn);
dynapi.document.addChild(btn2);
dynapi.document.addChild(btn3);

var cnt=0// onbuttonclick gives better performance than onclick in IE
btn.onbuttonclick = function(e){
  window.status = cnt++;
}

function setButtonStyle(t){
  btn.setStyle(t||'Button')
  //btn.setLocalStyleAttribute('foreColor','red');
  //btn.setEnabled(false);
}

function flatbutton2(t){
  // set local back ground color
  btn2.setLocalStyleAttribute('backColor','Yellow');
  btn2.setLocalStyleAttribute('mOverBackColor','Lime');
  btn2.setLocalStyleAttribute('mDownBackColor','#FFCC00');
  btn2.setLocalStyleAttribute('fontBold',true);
};

function greenbutton(){
  btn3.setStyle('ButtonImage');
  btn3.setLocalStyleAttribute('imageOn',dynapi.functions.getImage('./dynapiexamples/images/btn_green_on.gif',22,22));
}


</script>
</head>
<body bgcolor="#FFFFFF">
<p>&nbsp;</p>
<a href="javascript:;" onclick="setButtonStyle('Button')">Standard Button</a><br>
<a href="javascript:;" onclick="setButtonStyle('ButtonFlat')">Flat Button</a><br>
<a href="javascript:;" onclick="setButtonStyle('ButtonImage')">Image Button (Fixed Size)</a><br><br>
<a href="javascript:;" onclick="greenbutton()">Image Button #- Green</a><br><br>
<a href="javascript:;" onclick="flatbutton2()">Flat Button #- Customized</a><br>
<script>
  dynapi.document.insertAllChildren();
</script>
</body>
</html>
           
       
dynapi.zip( 791 k)
Related examples in the same category
1. HTML Button
2. Button widget
w__w__w__.___j__av__a2___s_.c___o_m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.