13
13
< h1 > cxDialog 对话框</ h1 >
14
14
</ div >
15
15
</ header >
16
-
17
16
< div class ="main ">
18
17
< div class ="wrap ">
19
18
< h2 > 示例</ h2 >
19
+
20
20
< form id ="example " action ="javascript:// " method ="get ">
21
21
< fieldset >
22
22
< legend > 按钮</ legend >
@@ -47,11 +47,15 @@ <h2>示例</h2>
47
47
48
48
< fieldset >
49
49
< legend > 显示对话框</ legend >
50
- < button type ="button " name ="alert "> 模拟 alert</ button >
51
- < button type ="button " name ="confirm "> 模拟 confirm</ button >
52
- < button type ="button " name ="prompt "> 模拟 prompt</ button >
53
- < p id ="result_confirm "> </ p >
54
- < p id ="result_prompt "> </ p >
50
+ < section id ="acts " class ="acts ">
51
+ < a href ="javascript:// " rel ="alert "> 模拟 alert</ a >
52
+ < a href ="javascript:// " rel ="confirm "> 模拟 confirm</ a >
53
+ < a href ="javascript:// " rel ="prompt "> 模拟 prompt</ a >
54
+ </ section >
55
+ < section >
56
+ < p id ="result_confirm "> </ p >
57
+ < p id ="result_prompt "> </ p >
58
+ </ section >
55
59
</ fieldset >
56
60
</ form >
57
61
@@ -120,16 +124,17 @@ <h2>协议</h2>
120
124
$ . extend ( $ . cxDialog . defaults , opts ) ;
121
125
} ;
122
126
123
- form . on ( 'click' , 'button' , function ( ) {
127
+ $ ( '#acts' ) . on ( 'click' , 'a' , function ( ) {
128
+ event . preventDefault ( ) ;
124
129
var _this = this ;
125
- var _name = _this . name ;
130
+ var _rel = _this . rel ;
126
131
127
132
setOptions ( ) ;
128
133
129
- if ( _name === 'alert' ) {
134
+ if ( _rel === 'alert' ) {
130
135
$ . cxDialog ( 'Hello World<br>I am cxDialog' ) ;
131
136
132
- } else if ( _name === 'confirm' ) {
137
+ } else if ( _rel === 'confirm' ) {
133
138
$ . cxDialog ( {
134
139
title : 'cxDialog' ,
135
140
info : '现在开始使用 <strong>cxDialog</strong>' ,
@@ -141,7 +146,7 @@ <h2>协议</h2>
141
146
}
142
147
} ) ;
143
148
144
- } else if ( _name === 'prompt' ) {
149
+ } else if ( _rel === 'prompt' ) {
145
150
$ . cxDialog ( {
146
151
title : 'cxDialog' ,
147
152
info : document . getElementById ( 'prompt_box' ) ,
0 commit comments