home *** CD-ROM | disk | FTP | other *** search
/ Chip: Shareware for Win 95 / Chip-Shareware-Win95.bin / komunik / ie40 / ie4nt_s2.cab / IE4NT_2.CAB / MSHTML.DLL / 2110 / REPLACE.DLG < prev    next >
Encoding:
Text File  |  1997-07-12  |  8.3 KB  |  263 lines

  1. <HTML STYLE="font-family: ms sans serif; font-size: 8pt; width: 34.1em;
  2. height: 14em">
  3. <HEAD>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <TITLE id=dialogTitle>
  6. Replace
  7. </TITLE>
  8. <SCRIPT LANGUAGE="JavaScript" defer>
  9. var fFindEnabled = false; 
  10. function callHelp()
  11. {
  12.  var L_NoHelp_Text = "No help topic available.";
  13.  var elm = window.event.srcElement;
  14.  if (null != elm.helpid)
  15.  {
  16.   if ("btnCancel" != elm.id)
  17.   {
  18.    window.showHelp("iexplore.hlp", parseInt(elm.helpid));
  19.   }
  20.   else
  21.   {
  22.    window.showHelp("windows.hlp", parseInt(elm.helpid));
  23.   }
  24.  }
  25. function btnCancelClick()
  26. {
  27.  window.close();
  28. function findFlags()
  29. {
  30.  var htmlMatchWord = 2;
  31.  var htmlMatchCase = 4;
  32.  return (htmlMatchWord * document.all.chkWholeWord.checked)
  33.   | (htmlMatchCase * document.all.chkMatchCase.checked)
  34. function btnFindClick()
  35. {
  36.  var L_FinishedDocument_Text = "Finished searching the document.";
  37.  var docSearch = window.dialogArguments.document; 
  38.  var intDirection;  
  39.  var rngCurrent = docSearch.selection.createRange(); 
  40.  var rngWorking = docSearch.body.createTextRange(); 
  41.  var rngFoundText;  
  42.  var fFoundText = false; 
  43.  if ((docSearch.selection.type == "Text") ||
  44.   (docSearch.selection.type == "None"))
  45.  {
  46.   fFoundText = (rngCurrent.text.toLowerCase()
  47.    == txtFindText.value.toLowerCase());
  48.  }
  49.  if (radDirection[0].checked) 
  50.  {
  51.   if (!fFoundText)
  52.   {
  53.    rngWorking.end = rngCurrent.end;
  54.   }
  55.   else
  56.   {
  57.    rngWorking.end = rngCurrent.end - 1;
  58.   }
  59.   intDirection = rngWorking.start - rngWorking.end 
  60.  }
  61.  else       
  62.  {
  63.   if (!fFoundText)
  64.   {
  65.    rngWorking.start = rngCurrent.start;
  66.   }
  67.   else
  68.   {
  69.    rngWorking.start = rngCurrent.start + 1;
  70.   }
  71.   intDirection = rngWorking.end - rngWorking.start 
  72.  }
  73.  rngFoundText = rngWorking.duplicate();
  74.  success = rngFoundText.findText(txtFindText.value, intDirection, findFlags());
  75.  if (!success) 
  76.  {
  77.   alert(L_FinishedDocument_Text);
  78.  }
  79.  else      
  80.  {
  81.   rngFoundText.select();
  82.   rngFoundText.scrollIntoView(true);
  83.  }
  84. function defaultActions()
  85. {
  86.  var htmlKeyReturn = 13;
  87.  var htmlKeyEscape = 27;
  88.  if ((event.keyCode) == htmlKeyReturn)  
  89.  {
  90.   if (!btnFind.disabled)
  91.   {
  92.    btnFindClick();
  93.    btnFind.focus();
  94.   }
  95.  }
  96.  else if ((event.keyCode) == htmlKeyEscape) 
  97.  {
  98.   btnCancelClick();
  99.  }
  100. function setFindState()
  101. {
  102.  if (("" == txtFindText.value) == fFindEnabled)
  103.  {
  104.   btnFind.disabled = !btnFind.disabled;
  105.   btnReplace.disabled = !btnReplace.disabled;
  106.   btnReplaceAll.disabled = !btnReplaceAll.disabled;
  107.   fFindEnabled = !fFindEnabled;
  108.  }
  109. function btnReplaceAllClick()
  110. {
  111.  var docSearch = window.dialogArguments.document;
  112.  var L_FinishedReplaceAll_Text = "Finished replace all";
  113.  var rngFindText;
  114.  var intDocEnd;  
  115.  rngFindText = docSearch.body.createTextRange();
  116.  intDocEnd = rngFindText.end;
  117.  success = rngFindText.findText(txtFindText.value, 0, findFlags());
  118.  while (success) 
  119.  {
  120.   rngFindText.text = txtReplaceText.value;
  121.   rngFindText.end = intDocEnd;
  122.   rngFindText.findText(txtFindText.value, 0, findFlags());
  123.  }
  124.  alert(L_FinishedReplaceAll_Text);
  125. function btnReplaceClick()
  126. {
  127.  var docSearch = window.dialogArguments.document;
  128.  var rngWorking = docSearch.selection.createRange();
  129.  if (txtFindText.value == rngWorking.text) 
  130.  {
  131.   rngWorking.text = txtReplaceText.value;
  132.  }
  133.  btnFindClick();
  134. function loadBdy()
  135. {
  136.  var docSearch = window.dialogArguments.document;
  137.  var rng = docSearch.selection.createRange();
  138.  btnFind.onclick   = new Function("btnFindClick()");
  139.  btnCancel.onclick  = new Function("btnCancelClick()");
  140.  btnReplace.onclick  = new Function("btnReplaceClick()");
  141.  btnReplaceAll.onclick = new Function("btnReplaceAllClick()");
  142.  document.onhelp  = new Function("callHelp()");
  143.  document.onkeypress = new Function("defaultActions()");
  144.  txtFindText.onkeyup = new Function("setFindState()");
  145.  txtFindText.onfocus = new Function("txtFindText.select()");
  146.  txtReplaceText.onfocus = new Function("txtReplaceText.select()");
  147.  txtFindText._enabled = false
  148.  if ("Text" == docSearch.selection.type)
  149.  {
  150.   if (16 > rng.text.length)
  151.   {
  152.    txtFindText.value = rng.text;
  153.    txtFindText.select();
  154.   }
  155.  }
  156.  setFindState();
  157. </SCRIPT>
  158. </HEAD>
  159. <BODY ID=bdy onLoad="loadBdy()" style="font-family: ms sans serif;
  160. font-size: 8pt; background: buttonface;">
  161. <DIV align=absMiddle style="font-family: ms sans serif; font-size: 8pt;
  162. position: absolute; LEFT: 1em; TOP: 1.3em; WIDTH: 8em; HEIGHT: 1em;">
  163. <LABEL FOR=txtFindText ID=lblFindText>
  164. Fi<U>n</U>d what:
  165. </LABEL>
  166. </DIV>
  167. <DIV align=absMiddle style="font-family: ms sans serif; font-size: 8pt;
  168. position: absolute; LEFT: 1em; TOP: 3.8em; WIDTH: 8em; HEIGHT: 1em;">
  169. <LABEL FOR=txtReplaceText ID=lblReplaceText>
  170. Re<U>p</U>lace with:
  171. </LABEL>
  172. </DIV>
  173. <INPUT type=text id=txtFindText ACCESSKEY=n tabIndex=5
  174. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  175. LEFT: 7.2em; TOP: 1em; WIDTH: 17.5em; HEIGHT: 2.1em">
  176. <INPUT type=text id=txtReplaceText ACCESSKEY=p tabIndex=8
  177. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  178. LEFT: 7.2em; TOP: 3.5em; WIDTH: 17.5em; HEIGHT: 2.1em">
  179. <BUTTON id=btnFind ACCESSKEY=f DISABLED=1 tabIndex=60
  180. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  181. LEFT: 25.7em; TOP: 1em; WIDTH: 6.8em; HEIGHT: 2.1em">
  182. <U>F</U>ind Next
  183. </BUTTON>
  184. <BUTTON id=btnReplace ACCESSKEY=r DISABLED=1 tabIndex=65
  185. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  186. LEFT: 25.7em; TOP: 3.5em; WIDTH: 6.8em; HEIGHT: 2.1em">
  187. <U>R</U>eplace
  188. </BUTTON>
  189. <BUTTON id=btnReplaceAll ACCESSKEY=a DISABLED=1 tabIndex=70
  190. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  191. LEFT: 25.7em; TOP: 6em; WIDTH: 6.8em; HEIGHT: 2.1em">
  192. Replace <U>A</U>ll
  193. </BUTTON>
  194. <BUTTON id=btnCancel tabIndex=75
  195. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  196. LEFT: 25.7em; TOP: 8.5em; WIDTH: 6.8em; HEIGHT: 2.1em">
  197. Cancel
  198. </BUTTON>
  199. <INPUT id=chkWholeWord type=checkbox ACCESSKEY=w tabIndex=40
  200. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  201. LEFT: 1em; TOP: 7.6em; WIDTH: 1em; HEIGHT: 1em">
  202. <INPUT id=chkMatchCase type=checkbox ACCESSKEY=c tabIndex=45
  203. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  204. LEFT: 1em; TOP: 9.4em; WIDTH: 1em; HEIGHT: 1em">
  205. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  206. LEFT: 2.6em; TOP: 7.6em; WIDTH: 11em; HEIGHT: 1.3em">
  207. <LABEL FOR=chkWholeWord id=lblWholeWord tabIndex="-1">
  208. Match <U>w</U>hole word only
  209. </LABEL>
  210. </DIV>
  211. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  212. LEFT: 2.6em; TOP: 9.4em; WIDTH: 10em; HEIGHT: 1em">
  213. <LABEL FOR=chkMatchCase id=lblMatchCase tabIndex="-1">
  214. Match <U>C</U>ase
  215. </LABEL>
  216. </DIV>
  217. <TABLE cellspacing cellPadding=7 borderColorDark=buttonhighlight
  218. borderColorLight=buttonshadow border=1 noshade="yes"
  219. style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  220. LEFT: 14.5em; TOP: 7.5em; WIDTH: 9.5em; HEIGHT: 3em">
  221. <TR>
  222.  <TD style="font-family: ms sans serif; font-size: 8pt;
  223.  width: 6.4em; height: 2em;">
  224.  <DIV style="color: buttonface">a</DIV>
  225.  </TD>
  226. </TR>
  227. </TABLE>
  228.  <INPUT id=radDirectionUp type=radio name=radDirection ACCESSKEY=u
  229.  tabIndex=50
  230.  style="position: absolute;font-family: ms sans serif; font-size: 8pt;
  231.  top: 8.6em; left: 15.3em; width: 1em; height: 1em;">
  232.  <DIV style="position: absolute;font-family: ms sans serif;
  233.  font-size: 8pt;top: 8.6em; left: 17em; width: 2em; height: 2em;">
  234.  <LABEL FOR=radDirectionUp id=lblDirectionUp tabIndex="-1"
  235.  STYLE="font-family: ms sans serif; font-size: 8pt"> <U>U</U>p </LABEL>
  236.  </DIV>
  237.  <INPUT id=radDirectionDown type=radio CHECKED name=radDirection
  238.  ACCESSKEY=d tabIndex=55
  239.  style="position: absolute;font-family: ms sans serif; font-size: 8pt;
  240.  top: 8.6em; left: 19.25em; width: 1em; height: 1em;">
  241.  <DIV style="position: absolute;font-family: ms sans serif;
  242.  font-size: 8pt;top: 8.6em; left: 20.75em; width: 3em; height: 1em;">
  243.  <LABEL FOR=radDirectionDown id=lblDirectionDown tabIndex="-1"
  244.  STYLE="font-family: ms sans serif; font-size: 8pt"> <U>D</U>own </LABEL>
  245.  </DIV>
  246. <DIV style="font-family: ms sans serif; font-size: 8pt; position: absolute;
  247. background: buttonface; HEIGHT: 1em; LEFT: 15em; TOP: 7em; WIDTH: 4.1em">
  248. <LABEL id=lblDirection tabIndex="-1" STYLE="font-family: ms sans serif;
  249. font-size: 8pt;">
  250.  Direction </LABEL>
  251. </DIV>
  252. </BODY>
  253. </HTML>
  254.