119 lines
3.8 KiB
HTML
119 lines
3.8 KiB
HTML
|
|
<HTML>
|
|||
|
|
<HEAD>
|
|||
|
|
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
|
|||
|
|
<script language=javascript src="dialog.js"></script>
|
|||
|
|
<link href='dialog.css' type='text/css' rel='stylesheet'>
|
|||
|
|
<TITLE><EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <20>滻</TITLE>
|
|||
|
|
|
|||
|
|
<script language="JavaScript">
|
|||
|
|
|
|||
|
|
var oSelection;
|
|||
|
|
oSelection = dialogArguments.document.selection.createRange();
|
|||
|
|
|
|||
|
|
function searchtype(){
|
|||
|
|
var retval = 0;
|
|||
|
|
var matchcase = 0;
|
|||
|
|
var matchword = 0;
|
|||
|
|
if (document.frmSearch.blnMatchCase.checked) matchcase = 4;
|
|||
|
|
if (document.frmSearch.blnMatchWord.checked) matchword = 2;
|
|||
|
|
retval = matchcase + matchword;
|
|||
|
|
return(retval);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function checkInput(){
|
|||
|
|
if (document.frmSearch.strSearch.value.length < 1) {
|
|||
|
|
alert("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
|
return false;
|
|||
|
|
} else {
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function findtext(){
|
|||
|
|
if (checkInput()) {
|
|||
|
|
var searchval = document.frmSearch.strSearch.value;
|
|||
|
|
oSelection.collapse(false);
|
|||
|
|
if (oSelection.findText(searchval, 1000000000, searchtype())) {
|
|||
|
|
oSelection.select();
|
|||
|
|
} else {
|
|||
|
|
var startfromtop = confirm("<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><C9A3>Ƿ<EFBFBD>Ҫ<EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|||
|
|
if (startfromtop) {
|
|||
|
|
oSelection.expand("textedit");
|
|||
|
|
oSelection.collapse();
|
|||
|
|
oSelection.select();
|
|||
|
|
findtext();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function replacetext(){
|
|||
|
|
if (checkInput()) {
|
|||
|
|
if (document.frmSearch.blnMatchCase.checked){
|
|||
|
|
if (oSelection.text == document.frmSearch.strSearch.value) oSelection.text = document.frmSearch.strReplace.value
|
|||
|
|
} else {
|
|||
|
|
if (oSelection.text.toLowerCase() == document.frmSearch.strSearch.value.toLowerCase()) oSelection.text = document.frmSearch.strReplace.value
|
|||
|
|
}
|
|||
|
|
findtext();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function replacealltext(){
|
|||
|
|
if (checkInput()) {
|
|||
|
|
var searchval = document.frmSearch.strSearch.value;
|
|||
|
|
var wordcount = 0;
|
|||
|
|
var msg = "";
|
|||
|
|
oSelection.expand("textedit");
|
|||
|
|
oSelection.collapse();
|
|||
|
|
oSelection.select();
|
|||
|
|
while (oSelection.findText(searchval, 1000000000, searchtype())){
|
|||
|
|
oSelection.select();
|
|||
|
|
oSelection.text = document.frmSearch.strReplace.value;
|
|||
|
|
wordcount++;
|
|||
|
|
}
|
|||
|
|
if (wordcount == 0) msg = "Ҫ<><D2AA><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD>"
|
|||
|
|
else msg = wordcount + " " + "<22><><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD>滻<EFBFBD>ɹ<EFBFBD>";
|
|||
|
|
alert(msg);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function InitDocument(){
|
|||
|
|
adjustDialog();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
</script>
|
|||
|
|
|
|||
|
|
</HEAD>
|
|||
|
|
<BODY onload="InitDocument()">
|
|||
|
|
<table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize><tr><td>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<TABLE CELLSPACING="0" cellpadding="0" border="0" align=center>
|
|||
|
|
<FORM NAME="frmSearch" method="post" action="">
|
|||
|
|
<TR>
|
|||
|
|
<TD VALIGN="top" align="left" nowrap width="60%">
|
|||
|
|
<label for="strSearch"><EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD></label><br>
|
|||
|
|
<INPUT TYPE=TEXT SIZE=25 NAME=strSearch id="strSearch"><br>
|
|||
|
|
<label for="strReplace"><EFBFBD>滻<EFBFBD><EFBFBD><EFBFBD><EFBFBD></label><br>
|
|||
|
|
<INPUT TYPE=TEXT SIZE=25 NAME=strReplace id="strReplace"><br>
|
|||
|
|
<INPUT TYPE=Checkbox NAME=blnMatchCase ID="blnMatchCase"><label for="blnMatchCase"><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD>Сд</label><br>
|
|||
|
|
<INPUT TYPE=Checkbox NAME=blnMatchWord ID="blnMatchWord"><label for="blnMatchWord">ȫ<EFBFBD><EFBFBD>ƥ<EFBFBD><EFBFBD></label>
|
|||
|
|
</td>
|
|||
|
|
<td width="5%">
|
|||
|
|
<td rowspan="2" valign="bottom" width="35%">
|
|||
|
|
<table border=0 cellpadding=0 cellspacing=5 width="100%" align=center>
|
|||
|
|
<tr><td><input type=button style="width:100%" name="btnFind" onClick="findtext();" value="<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>"></td></tr>
|
|||
|
|
<tr><td><input type=button style="width:100%" name="btnCancel" onClick="window.close();" value="<22>ر<EFBFBD>"></td></tr>
|
|||
|
|
<tr><td><input type=button style="width:100%" name="btnReplace" onClick="replacetext();" value="<22>滻"></td></tr>
|
|||
|
|
<tr><td><input type=button style="width:100%" name="btnReplaceall" onClick="replacealltext();" value="ȫ<><C8AB><EFBFBD>滻"></td></tr>
|
|||
|
|
</table>
|
|||
|
|
</td>
|
|||
|
|
</tr>
|
|||
|
|
</FORM>
|
|||
|
|
</table>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</td></tr></table>
|
|||
|
|
</BODY>
|
|||
|
|
</HTML>
|