Wrox Programmer Forums
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 11th, 2003, 03:42 PM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default search in HTML

Hi

I have an HTMl page which I want to search for a specific word in it by a small program which I should able to run that program and if it finds that word, return me "found it" otherwise sends me a popup warning which says "not found".
how can I write do this.
my html page is just tables and the info inside of the cells.
looking for the best solution.

thank you

 
Old August 12th, 2003, 04:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

There are several technologies you can use to make such a program. One is JavaScript witch runs on the client browser. JavaScript is really the only choice if you don't want to do it server-side. Because it's browser independent unlike VBScript. Other means is Java Server Pages (JSP), Active Server Pages (ASP), PHP and Common Gateway Interface (CGI - using Perl or Python) if you want do it server-side. You almost only want to do it clien-side if the content is in some sort of database.

Using JavaScript you can dynamically use CSS to mark the found word. Neat :-)


Regards - Jon
 
Old August 12th, 2003, 12:23 PM
Registered User
 
Join Date: Aug 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I believe Javascript is the best solution but I can't get access to that specific page otherwise I knew how to write it with ASP or even .NET but my question is for now which I have no access to the source code of that page, how can I write that code to search the word for me by searching the page?
if you have any idea, type it here pls. even any kind of sample of Jscript code is a great help.



 
Old August 12th, 2003, 08:28 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Uhm, what's wrong with Ctrl+F?

(o<
//\ =^..^=
 
Old June 14th, 2004, 06:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 217
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to mega
Default

If you're still monitoring this post then the XMLParser is a great way of doing it.

 - mega
 
Old June 14th, 2004, 06:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Since this topic has been dug up again, here's my input:

Create a frames page (yes I know frames are outdated) with a small frame on the top and a large frame (the page you want to search) on the bottom.

In the top page, try something like this:

function findWord(stf) //called like this: findWord("example string to find");
{
 var sts = top.frames[1].document.body.createTextRange();
 if(sts.findText(stf))
 {
  alert("String found!!");
  sts.scrollIntoView();
 }
 else
  alert("String not in document");
}

FWIW,

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
AJAX Use Search with HTMl controls and Datagrid Nikhil1978 Access ASP 0 December 27th, 2005 02:25 AM
Search Engine Optimization: Textarea, HTML comment anshul HTML Code Clinic 1 November 10th, 2005 07:47 AM
HTML text search JAtkinson VS.NET 2002/2003 0 February 29th, 2004 10:17 PM
Search engine that search through local drive! wenzation Classic ASP Basics 0 August 26th, 2003 09:15 PM
search in an HTML Page Shelly Javascript How-To 1 August 12th, 2003 06:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.