textarea.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <head>
  4. <title>文本框</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  6. <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
  7. <meta name="generator" content="www.leipi.org"/>
  8. <link rel="stylesheet" href="bootstrap/css/bootstrap.css">
  9. <!--[if lte IE 6]>
  10. <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
  11. <![endif]-->
  12. <!--[if lte IE 7]>
  13. <link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
  14. <![endif]-->
  15. <link rel="stylesheet" href="leipi.style.css">
  16. <script type="text/javascript" src="../dialogs/internal.js"></script>
  17. </head>
  18. <body>
  19. <div class="content">
  20. <table class="table table-bordered table-striped table-hover">
  21. <tr>
  22. <th><span>控件名称</span><span class="label label-important">*</span></th>
  23. <th><span>字体大小</span></th>
  24. </tr>
  25. <tr>
  26. <td><input id="orgname" type="text" placeholder="必填项"/></td>
  27. <td><input id="orgfontsize" type="text" value="" class="input-small span1" placeholder="auto"/> px</td>
  28. </tr>
  29. <tr>
  30. <th><span>输入框样式</span></th>
  31. <th><span>增强</span></th>
  32. </tr>
  33. <tr>
  34. <td>
  35. 宽 <input id="orgwidth" type="text" value="300" class="input-small span1" placeholder="auto"/> px
  36. &nbsp;&nbsp;
  37. 高 <input id="orgheight" type="text" value="80" class="input-small span1" placeholder="auto"/> px
  38. </td>
  39. <td><label class="checkbox"><input id="orgrich" type="checkbox"/> 富文本形式 </label></td>
  40. </tr>
  41. <tr>
  42. <td colspan="2">
  43. <label for="orgvalue">默认值</label>
  44. <textarea class="input-block-level" rows="3" id="orgvalue" placeholder="多行文本框默认值..."></textarea>
  45. </td>
  46. </tr>
  47. </table>
  48. </div>
  49. <script type="text/javascript">
  50. var oNode = null, thePlugins = 'textarea';
  51. ;
  52. window.onload = function () {
  53. if (UE.plugins[thePlugins].editdom) {
  54. oNode = UE.plugins[thePlugins].editdom;
  55. var gValue = oNode.getAttribute('value').replace(/&quot;/g, "\""),
  56. gTitle = oNode.getAttribute('title').replace(/&quot;/g, "\""),
  57. gFontSize = oNode.getAttribute('orgfontsize'), gWidth = oNode.getAttribute('orgwidth'),
  58. gHeight = oNode.getAttribute('orgheight'), gRich = oNode.getAttribute('orgrich');
  59. gValue = gValue == null ? '' : gValue;
  60. gTitle = gTitle == null ? '' : gTitle;
  61. $G('orgvalue').value = gValue;
  62. $G('orgname').value = gTitle;
  63. if (gRich == '1') {
  64. $G('orgrich').checked = true;
  65. }
  66. $G('orgfontsize').value = gFontSize;
  67. $G('orgwidth').value = gWidth;
  68. $G('orgheight').value = gHeight;
  69. }
  70. }
  71. dialog.oncancel = function () {
  72. if (UE.plugins[thePlugins].editdom) {
  73. delete UE.plugins[thePlugins].editdom;
  74. }
  75. };
  76. dialog.onok = function () {
  77. if ($G('orgname').value == '') {
  78. alert('请输入控件名称');
  79. return false;
  80. }
  81. var gValue = $G('orgvalue').value.replace(/\"/g, "&quot;"),
  82. gTitle = $G('orgname').value.replace(/\"/g, "&quot;"), gFontSize = $G('orgfontsize').value,
  83. gWidth = $G('orgwidth').value, gHeight = $G('orgheight').value;
  84. if (!oNode) {
  85. try {
  86. var html = '<textarea ';
  87. html += ' title = "' + gTitle + '"';
  88. html += ' name = "leipiNewField"';
  89. html += ' leipiPlugins = "' + thePlugins + '"';
  90. html += ' value = "' + gValue + '"';
  91. if ($G('orgrich').checked) {
  92. html += ' orgrich = "1"';
  93. } else {
  94. html += ' orgrich = "0"';
  95. }
  96. if (gFontSize != '') {
  97. html += ' orgfontsize = "' + gFontSize + '"';
  98. } else {
  99. html += ' orgfontsize = ""';
  100. }
  101. if (gWidth != '') {
  102. html += ' orgwidth = "' + gWidth + '"';
  103. } else {
  104. html += ' orgwidth = ""';
  105. }
  106. if (gHeight != '') {
  107. html += ' orgheight = "' + gHeight + '"';
  108. } else {
  109. html += ' orgheight = ""';
  110. }
  111. html += ' style = "';
  112. if (gFontSize != '') {
  113. html += 'font-size:' + gFontSize + 'px;';
  114. }
  115. if (gWidth != '') {
  116. html += 'width:' + gWidth + 'px;';
  117. }
  118. if (gHeight != '') {
  119. html += 'height:' + gHeight + 'px;';
  120. }
  121. html += '">';
  122. html += gValue + '</textarea>';
  123. editor.execCommand('insertHtml', html);
  124. } catch (e) {
  125. try {
  126. editor.execCommand('error');
  127. } catch (e) {
  128. alert('控件异常,请到 [雷劈网] 反馈或寻求帮助!');
  129. }
  130. return false;
  131. }
  132. } else {
  133. oNode.setAttribute('title', gTitle);
  134. oNode.setAttribute('value', gValue);
  135. oNode.innerHTML = gValue;
  136. if ($G('orgrich').checked) {
  137. oNode.setAttribute('orgrich', 1);
  138. } else {
  139. oNode.setAttribute('orgrich', 0);
  140. }
  141. if (gFontSize != '') {
  142. oNode.style.fontSize = gFontSize + 'px';
  143. oNode.setAttribute('orgfontsize', gFontSize);
  144. } else {
  145. oNode.setAttribute('orgfontsize', '');
  146. }
  147. if (gWidth != '') {
  148. oNode.style.width = gWidth + 'px';
  149. oNode.setAttribute('orgwidth', gWidth);
  150. } else {
  151. oNode.setAttribute('orgwidth', '');
  152. }
  153. if (gHeight != '') {
  154. oNode.style.height = gHeight + 'px';
  155. oNode.setAttribute('orgheight', gHeight);
  156. } else {
  157. oNode.setAttribute('orgheight', '');
  158. }
  159. delete UE.plugins[thePlugins].editdom;
  160. }
  161. };
  162. </script>
  163. </body>
  164. </html>