473,597 Members | 2,341 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Local jawascript search to search pages from only my website

HI
I want a jawascript that will search pages from only my subdomain
website eg. abc.efg.com
can anyone help me
please give the exact jawascript as I am not an expert programmer
please if possible email it to in************* **@gmail.com
awaiting
Manish wagh
Nov 8 '08 #1
5 2427
rf

"manish" <in************ ***@gmail.comwr ote in message
news:23******** *************** ***********@r37 g2000prr.google groups.com...
HI
I want a jawascript that will search pages from only my subdomain
website eg. abc.efg.com
can anyone help me
please give the exact jawascript as I am not an expert programmer
How is that going to help? Your Javascript lives on one single page. All the
other pages that need to be searched live on your host. Whatever you do you
will need a server side solution.
please if possible email it to in************* **@gmail.com
Nope.
Nov 8 '08 #2
manish wrote:
I want a jawascript that will search pages from only my subdomain
website eg. abc.efg.com
----------------------------------------------------------------
START CODE
----------------------------------------------------------------

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title>Search </title>
<script type="text/javascript">
var xhr;
var pages = ['1.htm', '2.htm', '3.htm', '4.htm', '5.htm'];

function do_srch(q) {
document.getEle mentById('resul ts').innerHTML = '';
document.getEle mentById('resti tle').innerHTML =
'<h3>Search results for \'<i>' + q + '<\/i>\'<\/h3>\n';
for (var i=0; i<pages.length ; i++) fetch(pages[i], q);
if (document.getEl ementById('resu lts').innerHTML == '') {
document.getEle mentById('resul ts').innerHTML = 'No results';
}
}

function fetch(page, q) {
xhr = null;
if (window.XMLHttp Request) {
xhr = new XMLHttpRequest( );
}
else if (window.ActiveX Object) {
xhr = new ActiveXObject(' Microsoft.XMLHT TP');
}
if (xhr != null) {
xhr.open('GET', page +'?' + (new Date()).getTime (), false);
xhr.send(null);
if (xhr.readyState == 4) {
if (xhr.status == 200) {
q = q.replace(
/(\\|\^|\$|\*|\+ |\?|\.|\{|\}|\( |\)|\:|\=|\!|\| |\,|\[|\])/g,
'\\$1');
if ((new RegExp(q)).test (xhr.responseTe xt))
document.getEle mentById('resul ts').innerHTML +=
'<a target="_blank" href="'+page+'" >'+page+'<\/a><br>
\n';
}
}
}
}
</script>
</head>
<body>
<form action="#"
onSubmit="do_sr ch(document.for ms[0].q.value); return false;">
<input size="40" type="text" name="q" value="apple">
<input type="submit" value="Search">
</form>
<div id="restitle"> </div>
<div id="results"></div>
</body>
</html>

----------------------------------------------------------------
END CODE
----------------------------------------------------------------

And the following pages to search:
1.htm: <html><body>2 apples and 1 pear</body></html>
2.htm: <html><body>3 oranges and 1 kiwi *</body></html>
3.htm: <html><body>4 pears and 1 app
le</body></html>
4.htm: <html><body>App les are great! \</body></html>
5.htm: <html><body>t wo apples</body></html>

See the direct demo at:
http://www.dotinternet.be/temp/xhr_src/xhr_src.htm

All files need to be placed on your same subdomain 'abc.efg.com'.
Wildcards are not allowed in the search queries. The search is case-
sensitive.

This demo works with defined files that are to be searched (see the
'pages'-variable). If you want XMLHttpRequest to search all files in a
directory, then you could do something like
http://groups.google.com/group/comp....f704292a72a661

Hope this helps,

--
Bart
Nov 8 '08 #3
Bart Van der Donck <ba**@nijlen.co mwrote in news:567bf9f1-aa40-44ff-8781-
2e**********@e3 8g2000prn.googl egroups.com:
....
xhr = new ActiveXObject(' Microsoft.XMLHT TP');
....
http://groups.google.com/group/comp....f704292a72a661
Will these methods work with non-MS browsers?
Nov 8 '08 #4
Mike Duffy meinte:
Bart Van der Donck <ba**@nijlen.co mwrote in news:567bf9f1-aa40-44ff-8781-
2e**********@e3 8g2000prn.googl egroups.com:
>....
xhr = new ActiveXObject(' Microsoft.XMLHT TP');
>....
http://groups.google.com/group/comp....f704292a72a661

Will these methods work with non-MS browsers?

If properly coded - yes.

Gregor
Nov 8 '08 #5
Mike Duffy wrote:
Bart Van der Donck <b...@nijlen.co mwrote in news:567bf9f1-aa40-44ff-
8781-2ef8d8fa9...@e3 8g2000prn.googl egroups.com:
>....
* *xhr = new ActiveXObject(' Microsoft.XMLHT TP');
....
Will these methods work with non-MS browsers?
Non-Microsoft browsers should support window.XMLHttpR equest. The
ActiveXObject call is for backwards compatibility with MSIE <7.

http://en.wikipedia.org/wiki/XMLHttp...ry_and_support

"The XMLHttpRequest concept was originally developed by
Microsoft [...] It has been available since the introduction
of Internet Explorer 5.0* [...] Internet Explorer versions prior
to 7.0 require XMLHTTP to be invoked as an ActiveXObject [...]
The Mozilla project incorporated the first compatible native
implementation of XMLHttpRequest in Mozilla 1.0 in 2002. This
implementation was later followed by Apple since Safari 1.2,
Konqueror, Opera Software since Opera 8.0, iCab since 3.0b352,
and Microsoft since Internet Explorer 7.0."

* = March 1999
see http://en.wikipedia.org/wiki/Internet_Explorer_5

--
Bart
Nov 8 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1569
by: bissatch | last post by:
Hi, I am about to build a web site that contains a news section. Basically, the site owner will login to an admin section and from there, be able to add news. What I would like to know is how can that news article (i.e. http://www.mysite.com/view-news.php?news_id=355) be automatically submitted to a search engine, such as Google. Is it possible? My concern is that search engines dont allow this for fear of spam.
0
4130
by: R. Rajesh Jeba Anbiah | last post by:
Q: Is PHP search engine friendly? Q: Will search engine spiders crawl my PHP pages? A: Spiders should crawl anything provided they're accessible. Since, nowadays most of the websites are been developed with PHP, you are not supposed to doubt that. As a proof that PHP pages could be crawled and indexed, refer this Google search
67
5984
by: Sandy.Pittendrigh | last post by:
Here's a question I don't know the answer to: I have a friend who makes very expensive, hand-made bamboo flyrods. He's widely recognized (in the fishing industry) as one of the 3-5 'best' rod makers in the world. He gets (sic) close to $5000 per custom made flyrod. A surprising number of people buy these fishing rods and never use them....they buy them as art-like investments. He is, after all, the best there is. But if you search on...
4
1815
by: Ove | last post by:
I have one Access 2000 DB on my website. I want to access these tables from my local database so i do not need to down-/upload the database each time i want to make changes. Meanwhile i want a external partner to access (just read) another database on my web. I have tried with "link tables" but do not succeed. Help please! /Ove H,
11
3509
by: emailus | last post by:
I am webmaster for the domain <www.alpha1.org.au>. Not being an expert in html, I take advantage of my domain Registrant's web building tool, 'Instant Website'. This tool is provided as part of the fee I pay for web hosting. 'Instant Website' provides the option of having your opening page as a Flash Page, which you'll see if you visit <www.alpha1.org.au>. Well, you'll see it if you visit from a Windows machine. For some reason, when...
8
2132
by: Roman | last post by:
I received a marketing call from a guy first showing me my website and then some other website and ranking of that other website. My questions is it worth paying to SEO corporation a $1200 - $3000 setup fee and then $150 monthly to get your website search optimized ? I used the domaintools.com and it seems like my website had higher SEO rating and tag relevance than the example site he was showing me. I did not pay attention to search...
6
1595
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, what determines how high a website's ranking will appear after being searched? what can i do to my website to give it a good chance of being ranked pretty high? thanks, rodchar
7
1967
nukefusion
by: nukefusion | last post by:
Hi all, I'm trying to think of the best way to achieve a certain goal and thought I would draw on the experience here. What I am currently doing is compiling a set of HTML files that form the help guide of an application I am working on. The help guide needs to be integrated into both a C# .NET desktop app AND a .NET based website using master pages. The requirements are that: (a) The same set of files are to be accessible through...
0
7971
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8381
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8259
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3889
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3932
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2408
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1243
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.