-
Notifications
You must be signed in to change notification settings - Fork 2
/
DropDownList.htm
103 lines (76 loc) · 2.67 KB
/
DropDownList.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
<!DOCTYPE html>
<html>
<head>
<title>DropDownList</title>
<link rel="stylesheet" type="text/css" href="jWebForm.css" />
<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">
function btnEditWidth_Click()
{
var ddlPerson = $j("ddlPerson");
var width = document.getElementById("txtWidth").value;
ddlPerson.Width(width);
}
function btnShowWidth_Click()
{
var ddlPerson = $j("ddlPerson");
var width = ddlPerson.Width();
alert(width);
}
function btnEditHeight_Click()
{
var ddlPerson = $j("ddlPerson");
var height = document.getElementById("txtHeight").value;
ddlPerson.Height(height);
}
function btnShowHeight_Click()
{
var ddlPerson = $j("ddlPerson");
var height = ddlPerson.Height();
alert(height);
}
$j.Page_Load = function Page_Load()
{
var ddlPerson = $j("ddlPerson");
ddlPerson.DataBind(
[
" ",
"小明",
"小刚",
"小红"
]
);
var ddlPerson2 = $j("ddlPerson2");
ddlPerson2.DataBind(
[
" ",
"小明",
"小刚",
"小红"
]
);
}
function ddlPerson2_SelectChanged(ddl)
{
var selectedText = ddl.SelectedText();
alert("SelectedText : " + "\"" + selectedText + "\"");
}
</script>
</head>
<body>
<input type="text" id="txtWidth" value="500px" />
<input type="button" value="修改 下拉框 宽度" onclick="btnEditWidth_Click(); "/>
<input type="button" value="显示 下拉框 宽度" onclick="btnShowWidth_Click(); " />
<br />
<input type="text" id="txtHeight" value="100px" />
<input type="button" value="修改 下拉框 高度" onclick="btnEditHeight_Click();" />
<input type="button" value="显示 下拉框 高度" onclick="btnShowHeight_Click();" />
<br /><br />
<j:DropDownList id="ddlPerson"></j:DropDownList>
<j:dropdownlist id="ddlPerson2" selectchanged="ddlPerson2_SelectChanged"></j:dropdownlist> selectChanged 事件
<br /><br />
DropDownList 是 display:inline-block 的,可以直接嵌入到布局中
</body>
</html>