1 | <!doctype html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-type" content="text/html; charset=utf-8"/> |
---|
5 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> |
---|
6 | <meta name="apple-mobile-web-app-capable" content="yes"> |
---|
7 | <title>Button</title> |
---|
8 | |
---|
9 | <script type="text/javascript" src="../deviceTheme.js" data-dojo-config="mblThemeFiles: ['base','Button']"></script> |
---|
10 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="async: true, parseOnLoad: true"></script> |
---|
11 | |
---|
12 | <script type="text/javascript"> |
---|
13 | require([ |
---|
14 | "dojo/_base/connect", |
---|
15 | "dojo/ready", |
---|
16 | "dojo/_base/array", |
---|
17 | "dojo/dom", |
---|
18 | "dijit/registry", |
---|
19 | "dojox/mobile/parser", |
---|
20 | "dojox/mobile", |
---|
21 | "dojox/mobile/compat", |
---|
22 | "dojox/mobile/Button" |
---|
23 | ], function(connect, ready, array, dom, registry){ |
---|
24 | ready(function(){ |
---|
25 | array.forEach(["btn1", "btn2", "btn3", "btn4", "btn5"], function(btnId){ |
---|
26 | var btnWidget = registry.byId(btnId); |
---|
27 | connect.connect(btnWidget.domNode, "click", onBtnClicked); |
---|
28 | }); |
---|
29 | }); |
---|
30 | function onBtnClicked(){ |
---|
31 | var span = dom.byId("msgArea"); |
---|
32 | span.innerHTML = """ + dom.byId(this.id).innerHTML + "" button was clicked."; |
---|
33 | setTimeout(function(){ |
---|
34 | span.innerHTML = ""; |
---|
35 | }, 1000); |
---|
36 | }; |
---|
37 | }); |
---|
38 | </script> |
---|
39 | |
---|
40 | <style> |
---|
41 | html,body { |
---|
42 | height: 100%; |
---|
43 | overflow: hidden; |
---|
44 | } |
---|
45 | hr { |
---|
46 | border: none; |
---|
47 | margin: 0; |
---|
48 | } |
---|
49 | button { |
---|
50 | width: 120px; |
---|
51 | margin: 15px 10px 0; |
---|
52 | } |
---|
53 | button.customButton { |
---|
54 | border-color: #cc3333; |
---|
55 | background-image: -webkit-gradient(linear, left top, left bottom, from(#D3656D), to(#BC1320), color-stop(0.5, #C9404B), color-stop(0.5, #BC1421)); |
---|
56 | color: #ffffff; |
---|
57 | } |
---|
58 | button.customButtonSelected { |
---|
59 | background-image: -webkit-gradient(linear, left top, left bottom, from(#AF333C), to(#880E17), color-stop(0.5, #952B33), color-stop(0.5, #870F18)); |
---|
60 | } |
---|
61 | .dj_gecko button.customButton { |
---|
62 | background-image: url(images/red-button-bg.png); |
---|
63 | } |
---|
64 | .dj_gecko button.customButtonSelected { |
---|
65 | background-image: url(images/red-button-sel-bg.png); |
---|
66 | } |
---|
67 | .dj_ie button.customButton { |
---|
68 | background-image: url(images/red-button-bg.png); |
---|
69 | } |
---|
70 | .dj_ie button.customButtonSelected { |
---|
71 | background-image: url(images/red-button-sel-bg.png); |
---|
72 | } |
---|
73 | </style> |
---|
74 | </head> |
---|
75 | <body style="visibility:hidden;"> |
---|
76 | <div data-dojo-type="dojox.mobile.View"> |
---|
77 | <h1 data-dojo-type="dojox.mobile.Heading">Button</h1> |
---|
78 | <button data-dojo-type="dojox.mobile.Button" id="btn1">Default</button> |
---|
79 | <hr> |
---|
80 | <button data-dojo-type="dojox.mobile.Button" id="btn2" class="mblBlueButton">Blue</button> |
---|
81 | class="mblBlueButton" |
---|
82 | <hr> |
---|
83 | <button data-dojo-type="dojox.mobile.Button" id="btn3" class="mblRedButton">Red</button> |
---|
84 | class="mblRedButton" |
---|
85 | <hr> |
---|
86 | <button data-dojo-type="dojox.mobile.Button" id="btn4" disabled>Disabled</button> |
---|
87 | disabled |
---|
88 | <hr> |
---|
89 | <button data-dojo-type="dojox.mobile.Button" id="btn5" class="customButton">Custom</button> |
---|
90 | class="customButton" |
---|
91 | <hr> |
---|
92 | <div id="msgArea" style="margin:15px"></div> |
---|
93 | </div> |
---|
94 | </body> |
---|
95 | </html> |
---|