home *** CD-ROM | disk | FTP | other *** search
/ PC User 2007 May / Australian_PC_User_2007-05.iso / software / brows / files / sbsetup.exe / FindNextKeyword.js < prev    next >
Encoding:
Text File  |  2006-05-08  |  508 b   |  18 lines

  1. function FindNextKeyword(sKeyword,iDirection,iFlags)
  2. {
  3.     var range,range0;
  4. //    debugger;
  5.     if (document.selection.type=='Text')
  6.     {
  7.         range0=document.selection.createRange();
  8.         range=range0.duplicate();
  9.         range.collapse(iDirection<0);
  10.     }
  11.     else
  12.         range=document.body.createTextRange();
  13.     var bFound=range.findText(sKeyword,iDirection*100000,iFlags);
  14.     if (bFound) range.select();
  15.     if (bFound) return "Found";
  16.     else if (document.selection.type=='Text') return "EndOfPage";
  17.     else return "NotFound";
  18. }