textarea.html
5.86 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>文本框</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" >
<meta name="generator" content="www.leipi.org" />
<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
<!--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
<![endif]-->
<!--[if lte IE 7]>
<link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
<![endif]-->
<link rel="stylesheet" href="leipi.style.css">
<script type="text/javascript" src="../dialogs/internal.js"></script>
</head>
<body>
<div class="content">
<table class="table table-bordered table-striped table-hover">
<tr>
<th><span>控件名称</span><span class="label label-important">*</span></th>
<th><span>字体大小</span> </th>
</tr>
<tr>
<td><input id="orgname" type="text" placeholder="必填项"/></td>
<td><input id="orgfontsize" type="text" value="" class="input-small span1" placeholder="auto"/> px</td>
</tr>
<tr>
<th><span>输入框样式</span> </th>
<th><span>增强</span> </th>
</tr>
<tr>
<td>
宽 <input id="orgwidth" type="text" value="300" class="input-small span1" placeholder="auto"/> px
高 <input id="orgheight" type="text" value="80" class="input-small span1" placeholder="auto"/> px
</td>
<td> <label class="checkbox"><input id="orgrich" type="checkbox" /> 富文本形式 </label> </td>
</tr>
<tr>
<td colspan="2">
<label for="orgvalue">默认值</label>
<textarea class="input-block-level" rows="3" id="orgvalue" placeholder="多行文本框默认值..."></textarea>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
var oNode = null,thePlugins = 'textarea';;
window.onload = function() {
if( UE.plugins[thePlugins].editdom ){
oNode = UE.plugins[thePlugins].editdom;
var gValue = oNode.getAttribute('value').replace(/"/g,"\""),gTitle=oNode.getAttribute('title').replace(/"/g,"\""),gFontSize=oNode.getAttribute('orgfontsize'),gWidth=oNode.getAttribute('orgwidth'),gHeight=oNode.getAttribute('orgheight'),gRich=oNode.getAttribute('orgrich');
gValue = gValue==null ? '' : gValue;
gTitle = gTitle==null ? '' : gTitle;
$G('orgvalue').value = gValue;
$G('orgname').value = gTitle;
if ( gRich == '1' ) {
$G('orgrich').checked = true ;
}
$G('orgfontsize').value = gFontSize;
$G('orgwidth').value = gWidth;
$G('orgheight').value = gHeight;
}
}
dialog.oncancel = function () {
if( UE.plugins[thePlugins].editdom ) {
delete UE.plugins[thePlugins].editdom;
}
};
dialog.onok = function (){
if($G('orgname').value==''){
alert('请输入控件名称');
return false;
}
var gValue=$G('orgvalue').value.replace(/\"/g,"""),gTitle=$G('orgname').value.replace(/\"/g,"""),gFontSize=$G('orgfontsize').value,gWidth=$G('orgwidth').value,gHeight=$G('orgheight').value;
if( !oNode ) {
try {
var html = '<textarea ';
html += ' title = "' + gTitle + '"';
html += ' name = "leipiNewField"';
html += ' leipiPlugins = "'+thePlugins+'"';
html += ' value = "' + gValue + '"';
if ( $G('orgrich').checked ) {
html += ' orgrich = "1"';
} else {
html += ' orgrich = "0"';
}
if( gFontSize != '' ) {
html += ' orgfontsize = "' + gFontSize + '"';
} else {
html += ' orgfontsize = ""';
}
if( gWidth != '' ) {
html += ' orgwidth = "' + gWidth + '"';
} else {
html += ' orgwidth = ""';
}
if(gHeight != '') {
html += ' orgheight = "' + gHeight + '"';
} else {
html += ' orgheight = ""';
}
html += ' style = "';
if( gFontSize != '' ) {
html += 'font-size:' + gFontSize + 'px;';
}
if( gWidth != '' ) {
html += 'width:' + gWidth + 'px;';
}
if( gHeight != '' ) {
html += 'height:' + gHeight + 'px;';
}
html += '">';
html += gValue + '</textarea>';
editor.execCommand('insertHtml',html);
} catch (e) {
try {
editor.execCommand('error');
} catch ( e ) {
alert('控件异常,请到 [雷劈网] 反馈或寻求帮助!');
}
return false;
}
} else {
oNode.setAttribute('title', gTitle);
oNode.setAttribute('value',gValue);
oNode.innerHTML = gValue;
if( $G('orgrich').checked ) {
oNode.setAttribute('orgrich', 1);
} else {
oNode.setAttribute('orgrich', 0);
}
if( gFontSize != '' ) {
oNode.style.fontSize = gFontSize+ 'px';
oNode.setAttribute('orgfontsize',gFontSize );
}else{
oNode.setAttribute('orgfontsize', '');
}
if( gWidth != '' ) {
oNode.style.width = gWidth+ 'px';
oNode.setAttribute('orgwidth',gWidth );
}else{
oNode.setAttribute('orgwidth', '');
}
if( gHeight != '' ) {
oNode.style.height = gHeight+ 'px';
oNode.setAttribute('orgheight',gHeight );
}else{
oNode.setAttribute('orgheight', '');
}
delete UE.plugins[thePlugins].editdom;
}
};
</script>
</body>
</html>