cool_textfield.aspx
上传用户:simon2hong
上传日期:2021-11-18
资源大小:16746k
文件大小:2k
源码类别:

OA系统

开发平台:

C#

  1. <%@ Page Language="C#" %>
  2. <html>
  3. <head>
  4. <title>单行输入框设定</title>
  5. <script>
  6. function my_submit()
  7. {
  8.   if(ITEM_NAME.value=="")
  9.   {
  10.      alert("控件名称不能为空");
  11.      return;
  12.   }
  13.   if(edit_flag==0)
  14.   {
  15.      var parent_window = parent.dialogArguments;
  16.      control_html="<input type=text title=""+ITEM_NAME.value.replace(""","&quot;")+"" value=""+ITEM_VALUE.value.replace(""","&quot;")+"" style="font-size:"+ITEM_SIZE.value+"">";
  17.      parent_window.EDIT_HTML.insertHtml(control_html);
  18.   }
  19.   else
  20.   {
  21.      oSelection = dialogArguments.document.selection.createRange();
  22.      sRangeType = dialogArguments.document.selection.type;
  23.    
  24.      if (sRangeType == "Control") 
  25.      {
  26.     oSelection(0).title = ITEM_NAME.value;
  27.     oSelection(0).value = ITEM_VALUE.value;
  28.     oSelection(0).style.fontSize = ITEM_SIZE.value;
  29.       }
  30.   }
  31.   
  32.   window.close();
  33. }
  34. //-- 获取控件属性 --
  35. var edit_flag=0;
  36. function LoadDo()
  37. {
  38.   oSelection = dialogArguments.document.selection.createRange();
  39.   sRangeType = dialogArguments.document.selection.type;
  40.   
  41.   if (sRangeType == "Control") 
  42.   {
  43.    edit_flag=1;
  44.    ITEM_NAME.value = oSelection(0).title;
  45.    ITEM_VALUE.value = oSelection(0).value;
  46.    ITEM_SIZE.value = oSelection(0).style.fontSize.replace("px","");
  47.   }
  48.   ITEM_NAME.focus();
  49. }
  50. </script>
  51. </head>
  52. <body topmargin="0" onload="LoadDo();">
  53. <table border="0" cellspacing="1" width="100%" class="small" bgcolor="#ffffff" cellpadding="3" align="center">
  54.   <tr class="TableContent">
  55.       <td nowrap>控件名称:
  56.       </td>
  57.       <td nowrap>
  58.        <Input name="ITEM_NAME" type="text" class="SmallInput" size="20">
  59.       </td>
  60.   </tr>
  61.   <tr class="TableContent">
  62.       <td nowrap>默认值:
  63.       </td>
  64.       <td nowrap>
  65.        <Input name="ITEM_VALUE" type="text" class="SmallInput" size="20">
  66.       </td>
  67.   </tr>
  68.   <tr class="TableContent">
  69.       <td nowrap>字体大小:
  70.       </td>
  71.       <td nowrap>
  72.        <Input name="ITEM_SIZE" type="text" class="SmallInput" size="20" title="可选,默认13像素">
  73.       </td>
  74.   </tr>
  75.   <tr>
  76.       <td class="TableControl" colspan="2" align="center">
  77.         <input type="submit" onclick="my_submit();" value="确 定" class="SmallButton">
  78.       </td>
  79.   </tr>
  80. </table>
  81. </body>
  82. </html>