-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.html
49 lines (46 loc) · 1.68 KB
/
examples.html
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
<html>
<head>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="dom-builder.js"></script>
<script type="text/javascript">
YAHOO.util.Event.onDOMReady(function (){
var $get = YAHOO.util.Dom.get;
//basic example
domBuilder($get('basic'))
.div({id: 'div1', style: 'height:50px;border-style:solid;border-width:4px;padding:1px;'})
.div({style: 'float: left;' })
.span().text('purple, ').end()
.a({href: 'http://www.google.com'}).text('google').end()
.end()
.div({style: 'float: right;' })
.span().text('cat').end()
.end();
//event handling
domBuilder($get('event'))
.div()
.span().text('some text').end()
.input({id:'evt_test', type: 'text'})
.on('blur', function() {alert('blur!!');})
.on('focus', function() {alert('focus!')})
.end();
//custom tags
domBuilder($get('custom'), ['select', 'optgroup', 'option'])
.select({id: 'select_test'})
.optgroup({label: 'swedish cars'})
.option({value: 'v'}).text('Volvo').end()
.option({value: 's'}).text('Saab').end()
.option({value: ''}).text('').end()
.end()
.optgroup({label: 'german cars'})
.option({value: 'm'}).text('Mercedes').end()
.option({value: 'a'}).text('Audi').end()
.end();
});
</script>
</head>
<body>
<div id="basic"></div>
<div id="event"></div>
<div id="custom"></div>
</body>
</html>