BVB Source Codes

Jie Yang v0.6.3 article system Show findreplace.htm Source code

Return Download Jie Yang v0.6.3 article system: download findreplace.htm Source code - Download Jie Yang v0.6.3 article system 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></HEAD>
  87. <BODY bgcolor="menu">
  88. <FORM NAME="frmSearch" method="post" action="">
  89. <TABLE CELLSPACING="0" cellpadding="5" border="0">
  90. <TR><TD VALIGN="top" align="left" nowrap>
  91.     <label for="strSearch">查找内容</label><br>
  92.     <INPUT TYPE=TEXT SIZE=40 NAME=strSearch id="strSearch" style="width : 200px;"><br>
  93.     <label for="strReplace">替换内容</label><br>
  94.     <INPUT TYPE=TEXT SIZE=40 NAME=strReplace id="strReplace" style="width : 200px;"><br>
  95.     <INPUT TYPE=Checkbox SIZE=40 NAME=blnMatchCase ID="blnMatchCase"><label for="blnMatchCase">区分大小写</label><br>
  96.     <INPUT TYPE=Checkbox SIZE=40 NAME=blnMatchWord ID="blnMatchWord"><label for="blnMatchWord">全部匹配</label>
  97. </td>
  98. <td rowspan="2" valign="top">
  99.     <input type=button style="width:80px;margin-top:15px" name="btnFind" onClick="findtext();" value="查找下一个"><br>
  100.     <input type=button style="width:80px;margin-top:5px" name="btnCancel" onClick="window.close();" value="关闭"><br>
  101.     <input type=button style="width:80px;margin-top:5px" name="btnReplace" onClick="replacetext();" value="替换"><br>
  102.     <input type=button style="width:80px;margin-top:5px" name="btnReplaceall" onClick="replacealltext();" value="全部替换"><br>
  103. </td>
  104. </tr>
  105. </table>
  106. </FORM>
  107. </BODY>
  108.  
  109.  
  110.  
downloadfindreplace.htm Source code - Download Jie Yang v0.6.3 article system Source code
Related Source Codes/Software:
Jilin classification information release system v5.0 trial version - A ready-made classifieds site publishing system, h... 2016-09-21
Linyi CMS v6.5 market classification information - A. supply and demand information function: informa... 2016-09-21
Tesco discount net SQL version - And presentations, faster. 2016-09-21
- electronic enterprise website management system In a fully functional version - Super suitable for enterprise agents build a corpo... 2016-09-21
Rio mesh network hard disk system v3.0 - System functions: 1, increase the progress of Asp... 2016-09-21
Classified information network business in suzhou - Overall module: classification of supply and deman... 2016-09-21
NPOINT virtual host v1.7.0 formal version management system - The system main function is introduced 2016-09-21
IDC sales web site - Beautiful IDC sales web site source code 2016-09-21
Oo 126 CMS movie site system - This procedure ASP + ACC/ASP + SQL, using new kern... 2016-09-21
Pcook CMS bubble guest v3.0 SDCMS version - Developed by Asp+Access, and meet the needs of sma... 2016-09-21
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top