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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>qooxdoo » Demo</title>
<link type="text/css" rel="stylesheet" href="../../resource/css/layout.css"/>
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="../../resource/css/layout_ie.css"/>
<![endif]-->
<script type="text/javascript" src="../../script/qx.js"></script>
<style type="text/css">
.box {
position: absolute;
width: 100px;
height: 100px;
left: 30px;
top: 40px;
color: white;
padding: 5px;
}
#box1 {
background-color: red;
}
#box2 {
background-color: blue;
top: 200px;
left: 100px;
}
</style>
</head>
<body>
<script type="text/javascript" src="../../script/layout.js"></script>
<div id="demoDescription">
<p>Some tests of qx.dom.StyleSheet</p>
</div>
<div id="box1" class="box">
Box 1
</div>
<div id="box2" class="box">
Box 2
</div>
<div style="display:none" id="control">
<p>
<h3>Box 1</h3>
<a href="javascript://" onclick="qx.dom.StyleSheet.addRule(sheet, '#box1', 'background-color:green !important');">qx.dom.StyleSheet.addRule(style, '#box1', 'background-color:green !important')</a> <br>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeRule(sheet, '#box1');">qx.dom.StyleSheet.removeRule(sheet, '#box1')</a> <br>
</p>
<h3>Box 1</h3>
<a href="javascript://" onclick="qx.dom.StyleSheet.addRule(sheet, '#box2', 'background-color:yellow !important');">qx.dom.StyleSheet.addRule(style, '#box2', 'background-color:yellow !important')</a> <br>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeRule(sheet, '#box2');">qx.dom.StyleSheet.removeRule(sheet, '#box2')</a> <br>
<p>
<h3>All</h3>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeAllRules(sheet)">qx.dom.StyleSheet.removeAllRules(sheet)</a> <br>
</p>
<p>
<h3>Import</h3>
add Import <br>
<a href="javascript://" onclick="qx.dom.StyleSheet.addImport(sheet, 'bigFont.css')">qx.dom.StyleSheet.addImport(sheet, 'bigFont.css')</a> <br>
<a href="javascript://" onclick="qx.dom.StyleSheet.addImport(sheet, 'boldFont.css')">qx.dom.StyleSheet.addImport(sheet, 'boldFont.css')</a> <br>
remove Import<br>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeImport(sheet, 'bigFont.css')">qx.dom.StyleSheet.removeImport(sheet, 'bigFont.css')</a> <br>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeImport(sheet, 'boldFont.css')">qx.dom.StyleSheet.removeImport(sheet, 'boldFont.css')</a> <br>
remove all Imports<br>
<a href="javascript://" onclick="qx.dom.StyleSheet.removeAllImports(sheet)">qx.dom.StyleSheet.removeAllImports(sheet)</a> <br>
</p>
</div>
<script type="text/javascript">
var sheet = qx.dom.StyleSheet.createElement();
qx.core.Init.getInstance().defineMain(function()
{
var d = qx.ui.core.ClientDocument.getInstance();
var ct1 = new qx.ui.basic.Label(document.getElementById("control").innerHTML);
with(ct1)
{
setWidth(450);
setRight(335);
setHeight(null);
setTop(48);
setBottom(48);
setOverflow("auto");
setBackgroundColor(new qx.renderer.color.Color("white"));
setBorder(qx.renderer.border.BorderPresets.getInstance().groove);
setPadding(10);
};
d.add(ct1);
});
</script>
</body>
</html>
|