Code Examples
  Home arrow Code Examples arrow Page 2 - Searching Body Text with textRange, part 1...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
VeriSign Whitepapers 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
CODE EXAMPLES

Searching Body Text with textRange, part 1: The Basic Script
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 17
    2005-06-23

    Table of Contents:
  • Searching Body Text with textRange, part 1: The Basic Script
  • Main Script Variants
  • Some Material to Search
  • Coding the Script File
  • How it Works

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Searching Body Text with textRange, part 1: The Basic Script - Main Script Variants


    (Page 2 of 5 )

    I will provide the main script in both JavaScript and VBScript variants.  Which one you choose to use will depend largely on personal preference as both scripts work equally as well. 

    I should point out now that this script (both the JavaScript and VBScript variants) will only work on Microsoft IE browsers. Not only is the textRange object only implemented by IE, and the findText method also only used in IE (although other browsers do support a createRange method), but the showModalDialog function that is used to call the search window is also an IE only method (although, the prompt method could be used in place of this to produce a dialog box to capture the search word.) 

    In reality, this issue should only affect a minority of your website visitors, as current trend analysis reveals that up to 88 percent of US-based surfers still use IE as their primary browser. This figure is dropping slowly as more users take up Firefox, and part of the current 88 percent may actually be using the Opera browser, which often reports itself as IE. Nevertheless, while designing scripts that will only run on certain users' computers is not an ideal scenario to find yourself in, I’m sure you’ll agree that it is better to include something that will improve the experience of most visitors, then to not include it at all.

    Additionally, your site may have some kind of browser-detection model in place that can re-direct visitors to specific parts of your site that cater to their browser type. The code contained and explained in this article could happily reside on an IE-only page, while an equivalent script that works on Gecko-based browsers is in place on other pages. A Gecko-friendly script will be the subject of article three in this series.

    More Code Examples Articles
    More By Dan Wellman


       · Why should I re-implement the "Find (on this page)" functionality that is provided...
       · Hi,That's a very valid point, however, I'm sure there are many people that are...
       · Sorry, can I also point out that many sites now feature an on-the-page text size...
     

    CODE EXAMPLES ARTICLES

    - Handling Animations and Bitmaps Using GDI+ f...
    - Download a Web Page using the WebClient
    - Creating a Chart using Data from a Database ...
    - The Basics of Charting with the MS Chart Con...
    - Searching Body Text with textRange: Enter th...
    - Searching Body Text with textRange: Building...
    - Searching Body Text with textRange, part 1: ...
    - First Steps in Programming
    - Programming in C
    - Quick Introduction to ASF,ASX, and Networkin...
    - SatView: Pointer Perfect, Part 2: Constructi...
    - SatView: Pointer Perfect, Part 1
    - Style Case Studies: Construction Unions
    - Creating an Engine for Games for Windows
    - Style Case Studies: Generic Callbacks





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway