ATB Source Codes

Source of party and Government official open source Government TS version v1.0 Show findreplace.htm Source code

Return Download Source of party and Government official open source Government TS version v1.0: download findreplace.htm Source code - Download Source of party and Government official open source Government TS version v1.0 Source code - Type:.htm
  1. <HTML>
  2. <HEAD>
  3. <TITLE>查找 / 替换</TITLE>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  5. <style type="text/css">
  6. body, a, table, div, span, td, th, input, select{font-size:9pt;font-family: "宋体", Verdana, Arial, Helvetica, sans-serif;}
  7. body {padding:5px}
  8. </style>
  9.  
  10. <script language="JavaScript">
  11. // 初始选定对象
  12. var oSelection;
  13. oSelection = dialogArguments.document.selection.createRange();
  14.  
  15. // 返回匹配条件
  16. function searchtype(){
  17.     var retval = 0;
  18.     var matchcase = 0;
  19.     var matchword = 0;
  20.     if (document.frmSearch.blnMatchCase.checked) matchcase = 4;
  21.     if (document.frmSearch.blnMatchWord.checked) matchword = 2;
  22.     retval = matchcase + matchword;
  23.     return(retval);
  24. }
  25.  
  26. // 检测输入
  27. function checkInput(){
  28.     if (document.frmSearch.strSearch.value.length < 1) {
  29.        alert("请输入查找内容");
  30.        return false;
  31.    } else {
  32.        return true;
  33.    }
  34. }
  35.  
  36. // 查找
  37. function findtext(){
  38.    if (checkInput()) {
  39.        var searchval = document.frmSearch.strSearch.value;
  40.        oSelection.collapse(false);
  41.        if (oSelection.findText(searchval, 1000000000, searchtype())) {
  42.            oSelection.select();
  43.        } else {
  44.            var startfromtop = confirm("搜索完成,是否要从顶部开始重新搜索?");
  45.            if (startfromtop) {
  46.                oSelection.expand("textedit");
  47.                oSelection.collapse();
  48.                oSelection.select();
  49.                findtext();
  50.            }
  51.        }
  52.    }
  53. }
  54.  
  55. // 在选中的文本中替换
  56. function replacetext(){
  57.    if (checkInput()) {
  58.        if (document.frmSearch.blnMatchCase.checked){
  59.            if (oSelection.text == document.frmSearch.strSearch.value) oSelection.text = document.frmSearch.strReplace.value
  60.        } else {
  61.            if (oSelection.text.toLowerCase() == document.frmSearch.strSearch.value.toLowerCase()) oSelection.text = document.frmSearch.strReplace.value
  62.        }
  63.        findtext();
  64.    }
  65. }
  66.  
  67. // 在所有内容中替换
  68. function replacealltext(){
  69.    if (checkInput()) {
  70.        var searchval = document.frmSearch.strSearch.value;
  71.        var wordcount = 0;
  72.        var msg = "";
  73.        oSelection.expand("textedit");
  74.        oSelection.collapse();
  75.        oSelection.select();
  76.        while (oSelection.findText(searchval, 1000000000, searchtype())){
  77.            oSelection.select();
  78.            oSelection.text = document.frmSearch.strReplace.value;
  79.            wordcount++;
  80.        }
  81.        if (wordcount == 0) msg = "要查找的内容没有找到"
  82.        else msg = wordcount + " 处文本被替换成功";
  83.        alert(msg);
  84.    }
  85. }
  86. </script>
  87.  
  88. </HEAD>
  89. <BODY bgcolor="menu">
  90. <FORM NAME="frmSearch" method="post" action="">
  91. <TABLE CELLSPACING="0" cellpadding="5" border="0">
  92. <TR><TD VALIGN="top" align="left" nowrap>
  93.     <label for="strSearch">查找内容</label><br>
  94.     <INPUT TYPE=TEXT SIZE=40 NAME=strSearch id="strSearch" style="width : 200px;"><br>
  95.     <label for="strReplace">替换内容</label><br>
  96.     <INPUT TYPE=TEXT SIZE=40 NAME=strReplace id="strReplace" style="width : 200px;"><br>
  97.     <INPUT TYPE=Checkbox SIZE=40 NAME=blnMatchCase ID="blnMatchCase"><label for="blnMatchCase">区分大小写</label><br>
  98.     <INPUT TYPE=Checkbox SIZE=40 NAME=blnMatchWord ID="blnMatchWord"><label for="blnMatchWord">全部匹配</label>
  99. </td>
  100. <td rowspan="2" valign="top">
  101.     <input type=button style="width:80px;margin-top:15px" name="btnFind" onClick="findtext();" value="查找下一个"><br>
  102.     <input type=button style="width:80px;margin-top:5px" name="btnCancel" onClick="window.close();" value="关闭"><br>
  103.     <input type=button style="width:80px;margin-top:5px" name="btnReplace" onClick="replacetext();" value="替换"><br>
  104.     <input type=button style="width:80px;margin-top:5px" name="btnReplaceall" onClick="replacealltext();" value="全部替换"><br>
  105. </td>
  106. </tr>
  107. </table>
  108. </FORM>
  109. </BODY>
  110. </HTML>
  111.  
downloadfindreplace.htm Source code - Download Source of party and Government official open source Government TS version v1.0 Source code
Related Source Codes/Software:
Sunzhuang town government - Simple and practical! 5.15KB
160 Shenzhen rental rental information network - Rental information network-a very good site, which... 79.99KB
Christmas blessings wishing wall - Christmas blessings wishing wall 3.56KB
ZerooneCMS v3.1 - A based on ASP.NET v2.0 of CMS, support Sql Server... 5.27KB
Zen Cart v1.3.0.2 Chinese Simplified version - Interface before and after culture in all, backgro... 15.93KB
Love agent shop navigation friendship China buffet chain V1.0 - Fully functional, application link, points into on... 4.34KB
Quanzhou China networks limited - Admin admin admin 21.45KB
Like webmaster forums - Administrator account: adminPassword: 86,552,4... 9.17KB
Journey of legends ASP.NET version system - Abbreviation for Cms is a Content Management Syste... 18.45KB
M media corporate website system v3.5.2 - M media on the powerful systems in addition to foc... 5.69KB
China source download System v1.0 - This 3-to beautify the program downloaded by the i... 5.26KB
Ganzhou Windows network - Cover feature:Windows Home | News vertical and... 34.61KB
Strains of strain of beautiful personal home page Build20061004 - -----------Modified part-------------1: added ... 7.7KB
Southwest agricultural information network - Southwest agricultural information network, an agr... 98.89KB
ZWMOBI 3G mobile station system - Powerful business modules, including mobile B2C mo... 3.89KB
As a campus site system v2.0 - For most school,, to built features powerful of ma... 44.88KB
Evening student seating system 7 - Evening student seating system is facilitated the ... 26.4KB
94KK be reluctant network community beautification bate3 (new year Edition) - Kernel KB 94kkBBS Forum, new landscaping, further ... 24.82KB
QQ Flash Word - 1. powerful DIY feature, which is now immeasurably... 67KB
Zoomla! Eall CMS v2.0 - Waves CMS is committed to providing our webmasters... 11.31KB

 Back to top