|
Dojo Tutorial |
|
enough to convert regular id attributes to
widgetId’s if no widgetId‘ attribute is explicitly
named.
Connecting an Event to the Widget
When you click the command button then it
doing something? We specify an onClick event
handler for the given command button.
dojo.require(“dojo.event.*”);
Above code we use “dojo.event.*” that includes
all events functionality of Dojo (But not all
widgets).
Following function that will called by the button
when we clicked. After clicking the “helloPressed”
method is called and it displays an alert message
like: “Click on the Hello World Button”.
function helloPressed()
{
alert(‘Click on the Hello World Button’);
}
Here is the code of program:
<html>
<head>
<title>button</title>
<script type=”text/javascript”>
dojo.require(“dojo.event.*”);
dojo.require(“dojo.widget.*”);
dojo.require(“dojo.widget.Button”);
function helloPressed()
{
alert(‘Click on the Hello World Button’);
}
function init()
{
var helloButton =
dojo.widget.byId(‘helloButton’);
dojo.event.connect(helloButton, ‘onClick’,
‘helloPressed’)
}
dojo.addOnLoad(init);
</script> |
|
</head>
<body bgcolor=”#FFFFCC”>
<p align=”center”><font size=”6"
color=”#800000">Welcome to Roseindia
Dojo Project</font></p>
<button dojoType=”Button”
widgetId=”helloButton”
onClick=”helloPressed();”>Hello World!</
button>
<br>
</body>
</html>
Output of program:
Tool tips Example
Tool tips: This is a GUI (Graphical User
Interface) element that is used in conjunction
with a cursor and usually a mouser pointer.
If the mouse cursor over an item, without
clicking a mouse it appears a small box with
supplementary information regarding the items.
Here is the code of program:
<html>
<head>
<title>Tooltip Demo</title>
<style type=”text/css”>
@import “../resources/dojo.css”;
|
|
March 2008 | Java Jazz Up | 41 |
|
|
|
View All Topics |
All Pages of this Issue |
Pages:
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23,
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47,
48,
49,
50,
51,
52,
53 ,
54,
55,
56,
57,
58,
59,
Download PDF |
|
|
|
|
|
|
|
|
|