| 2150 |
mathias |
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
|
|
2 |
"http://www.w3.org/TR/html4/strict.dtd">
|
|
|
3 |
<html>
|
|
|
4 |
<head>
|
|
|
5 |
<title>PROGRAMMATIC - Dojo Button 100 Test</title>
|
|
|
6 |
<script type="text/javascript" src="../../dojo/dojo.js" XdjConfig='isDebug: true, debugAtAllCosts: true'></script>
|
|
|
7 |
<script type="text/javascript">
|
|
|
8 |
dojo.require("dijit.form.Button");
|
|
|
9 |
dojo.require("dojo.parser");
|
|
|
10 |
logMessage = window.alert;
|
|
|
11 |
</script>
|
|
|
12 |
|
|
|
13 |
<style>
|
|
|
14 |
|
|
|
15 |
@import "../themes/tundra/tundra.css";
|
|
|
16 |
|
|
|
17 |
/* group multiple buttons in a row */
|
|
|
18 |
.box {
|
|
|
19 |
display: block;
|
|
|
20 |
text-align: center;
|
|
|
21 |
}
|
|
|
22 |
.box .dojoButton {
|
|
|
23 |
width:80px;
|
|
|
24 |
margin-right: 10px;
|
|
|
25 |
}
|
|
|
26 |
.dojoButtonContents {
|
|
|
27 |
font-size: 1.6em;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
#buttonContainer {
|
|
|
31 |
border:1px solid black;
|
|
|
32 |
width:100%;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
#results {
|
|
|
36 |
color:darkred;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
</style>
|
|
|
40 |
</head>
|
|
|
41 |
<body class=tundra>
|
|
|
42 |
<h2>Creating dojot.form.buttons programmatically</h2>
|
|
|
43 |
<h3 id="results"></h3>
|
|
|
44 |
|
|
|
45 |
<div id="buttonContainer" class='box'></div>
|
|
|
46 |
|
|
|
47 |
<br>
|
|
|
48 |
Pass "?count=<i><b>n</b></i>" in the query string to change the number of buttons.
|
|
|
49 |
|
|
|
50 |
<script type="text/javascript">
|
|
|
51 |
// See if we can make a widget in script and attach it to the DOM ourselves.
|
|
|
52 |
|
|
|
53 |
function makeEm() {
|
|
|
54 |
var queryCount = location.search.match(/count=(\d*)/);
|
|
|
55 |
var count = (queryCount ? parseInt(queryCount[1]) : 100);
|
|
|
56 |
var container = dojo.byId("buttonContainer");
|
|
|
57 |
var t0 = new Date().getTime();
|
|
|
58 |
for (var i = 1; i <= count; i++) {
|
|
|
59 |
var it =
|
|
|
60 |
new dijit.form.Button(
|
|
|
61 |
{label:"Button "+i, onclick:'logMessage("clicked simple")'}
|
|
|
62 |
);
|
|
|
63 |
container.appendChild(it.domNode);
|
|
|
64 |
it.domNode.style.display = '';
|
|
|
65 |
}
|
|
|
66 |
var t1 = new Date().getTime();
|
|
|
67 |
dojo.byId("results").innerHTML = "It took " + (t1 - t0) + " msec to create " + count + " Buttons programmatically.";
|
|
|
68 |
}
|
|
|
69 |
dojo.addOnLoad(makeEm);
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
</script>
|
|
|
73 |
|
|
|
74 |
</body>
|
|
|
75 |
</html>
|