-
Notifications
You must be signed in to change notification settings - Fork 2
/
EditArea.htm
137 lines (101 loc) · 3.7 KB
/
EditArea.htm
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html>
<html>
<head>
<title>EditArea</title>
<link rel="stylesheet" type="text/css" href="jWebForm.css" />
<style type="text/css">
.colorBlock div {
width: 16px;
height: 16px;
margin: 2px;
}
</style>
<script type="text/javascript" src="jWebForm.js"></script>
<script type="text/javascript" src="DropDown.js"></script>
<script type="text/javascript" src="DropDownList.js"></script>
<script type="text/javascript" src="EditArea.js"></script>
<script type="text/javascript">
$j.Page_Load = function Page_Load() {
BindFontFamilyList();
BindFontSizeList();
BindColorDrop();
var editArea1 = $j("EditArea1");
editArea1.Init();
}
function BindFontFamilyList()
{
var ddlFontFamily = $j("ddlFontFamily");
ddlFontFamily.DataBind(
[
" ",
"Arial",
"宋体",
"微软雅黑"
]
);
}
function BindFontSizeList()
{
var ddlFontSize = $j("ddlFontSize");
ddlFontSize.DataBind(
[
" ",
"20px",
"30px",
"40px",
"50px",
"60px"
]
);
}
function BindColorDrop()
{
var ddnColor = $j("ddnColor");
var divColorTop = document.getElementById("divColorTop");
var divColorDrop = document.getElementById("divColorDrop");
ddnColor.Top(divColorTop);
ddnColor.Drop(divColorDrop);
}
function ddlFontFamily_SelectChanged(ddl)
{
var fontFamily = ddl.SelectedText().trim();
var editArea1 = $j("EditArea1");
editArea1.SetFontFamily(fontFamily);
}
function ddlFontSize_SelectChanged(ddl)
{
var fontSize = ddl.SelectedText().trim();
var editArea1 = $j("EditArea1");
editArea1.SetFontSize(fontSize);
}
function ddnColor_SelectColor(item)
{
var color = item.style.backgroundColor;
var editArea1 = $j("EditArea1");
editArea1.SetFontColor(color);
var ddnColor = $j("ddnColor");
ddnColor.Close();
}
</script>
</head>
<body>
<j:dropdownlist id="ddlFontFamily" selectchanged="ddlFontFamily_SelectChanged"></j:dropdownlist>
<j:dropdownlist id="ddlFontSize" selectchanged="ddlFontSize_SelectChanged"></j:dropdownlist>
<j:dropdown id="ddnColor"></j:dropdown>
<div id="divColorTop" class="colorBlock" style="width:20px;height:20px;border:solid 1px gray;">
<div style="background-color:red"></div>
</div>
<div id="divColorDrop" class="colorBlock" style="width:20px;border:solid 1px gray; background-color:white">
<div style="background-color:yellow" onclick="ddnColor_SelectColor(this);"></div>
<div style="background-color:red" onclick="ddnColor_SelectColor(this);"></div>
<div style="background-color:green" onclick="ddnColor_SelectColor(this);"></div>
<div style="background-color:blue" onclick="ddnColor_SelectColor(this);"></div>
<div style="background-color:black" onclick="ddnColor_SelectColor(this);"></div>
</div>
<div style="padding:40px">
<div style="width:480px; height:440px; border:solid 1px gray; overflow-y:auto">
<j:editarea id="EditArea1" minHeight="100%"></j:editarea>
</div>
</div>
</body>
</html>