在我的页面中添加搜索 [英] To add search in my page

查看:73
本文介绍了在我的页面中添加搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的页面内搜索。我怎样才能做到这一点。当我在网上搜索
时,它告诉我使用谷歌搜索。但我想为我的

网页做。我正在使用内网系统。

I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.

推荐答案

lak写道:
lak wrote:

我想要在我的页面内搜索。我怎样才能做到这一点。当我在网上搜索
时,它告诉我使用谷歌搜索。但我想为我的

网页做。我正在使用内网系统。
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.



你需要建立一个搜索引擎来检查每个页面生成的html

,将其解析为适当的单词,在数据库中对那些单词进行编目,然后将搜索参数与每个单词进行匹配。


当然除非你想要在每次搜索时搜索每一页,在

中,你不需要将这些单词存储在数据库中。但是这样一个

搜索,除非你的页面数量很少,否则需要更长的时间。


这样的搜索功能并不容易实现。但是如果你需要它,

可能最好的方法是用你已经内置的一个CMS来设置你的网站。

已经内置它。


-

==================

删除x ;来自我的电子邮件地址

Jerry Stuckle

JDS计算机培训公司
js ******* @ attglobal.net

==================

You''ll need to build a search engine which examines the generated html
for every page, parses it into the appropriate words, catalogs those
words in a database, then matches the search arguments to each word.

Unless, of course, you want to search every page on every search, in
which case you don''t need to store the words in a database. But such a
search, unless you have a very few number of pages, will take much longer.

Such a search function is not easy to implement. But if you need it,
probably the best way is to set your site up with one of the CMS''s which
has it already built in.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================


9月4日,3:21 * pm,lak< lakindi ... @ gmail.comwrote:
On Sep 4, 3:21*pm, lak <lakindi...@gmail.comwrote:

我想在我的页面内搜索。我怎样才能做到这一点。当我在网上搜索
时,它告诉我使用谷歌搜索。但我想为我的

网页做。我正在使用intra-net系统。
I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.



如果我没有正确理解,你没有太多内容。

ex。如果你没有超过1500 - 2000页,你可以简单地使用javascript进行搜索。


使用数组来存储你的数据,这将是使用,可用于

搜索过程;


Ex。 var data = new Array();


data [content] = new Array();


data [content] [0] = [" x.html","关键字","关键字1","关键字2" ...

" keywordn"];

__________________________________________________ ______________________________

< script language =" javascript">

//作者:Baryt?UHADAR,许可证:GPL ..

var c = new String(window.location); // http://foo.com/x.php?q=keyword

var s = c.split(" ="); //在=之后获取关键字

var flag = 0;


if(s [1])

{

s [1] = decodeURI(s [1]);


for(var i = 0; i< 3; i ++)
$ j $ 0; j< site_data [" content] [i] [" keywords"]。长度;

j ++)

if(site_data [" content"] [i] [" keywords"] [j] .match(s [1]))

{

document.write("< a href =" + site_data [" content"] [i] [0]

[0] +" >" + site_data [" content"] [i] [0] [1] +"< / a>");

document.write("< br> ;");

document.write(site_data [" content"] [i] [0] [2]);

document.write("< ; br>");

document.write("< br>");

flag = 1;

}

else if(flag!= 1){flag = 2;}

}

if(flag == 2)

{

document.write(找不到任何东西);

}

}

else if(flag == 0){document.write("输入要搜索的内容);}


< / script>

__________________________________________________ _____________________

当您通过循环搜索关键字时,您可以简单地构建一个

简单的js搜索引擎骨架。

If i unterstood correctly, you do not have too much content right.
ex. if you do not have much than 1500 - 2000 pages, you can simple
use javascript for search.

use arrays to store your data, which will be used, available for
search process;

Ex. var data = new Array();

data[content] = new Array();

data[content][0] = ["x.html","keyword","keyword1","keyword2" ...
"keywordn"];
__________________________________________________ ______________________________
<script language="javascript">
// Author: Baryt ?UHADAR, Licence: GPL..
var c = new String(window.location); // http://foo.com/x.php?q=keyword
var s = c.split("="); // gets the keyword after "="
var flag = 0;

if(s[1])
{
s[1]=decodeURI(s[1]);

for(var i = 0; i < 3; i++)
{
for(var j = 0; j < site_data["content"][i]["keywords"].length;
j++)
if(site_data["content"][i]["keywords"][j].match(s[1]))
{
document.write("<a href="+site_data["content"][i][0]
[0]+">"+site_data["content"][i][0][1]+"</a>");
document.write("<br>");
document.write(site_data["content"][i][0][2]);
document.write("<br>");
document.write("<br>");
flag = 1;
}
else if(flag !=1) { flag = 2;}
}
if(flag == 2)
{
document.write("nothing found");
}
}
else if(flag == 0) { document.write("enter something to search");}

</script>
__________________________________________________ _____________________

when you search within keywords by a loop, you can simply built a
simple js search engine skeleton.


Betikci Boris写道:
Betikci Boris wrote:

On 9月4日下午3:21,lak< lakindi ... @ gmail.comwrote:
On Sep 4, 3:21 pm, lak <lakindi...@gmail.comwrote:

>我想在我的页面内搜索。我怎样才能做到这一点。当我在网上搜索时,它告诉我使用谷歌搜索。但我想为我的
网页做。我正在使用intra-net系统。
>I want to search within my page. How can I do that. When I searched in
the net, it tells to use the google search. But I want to do for my
web page. I am using intra-net system.



如果我没有正确理解,你没有太多内容。

ex。如果你没有超过1500 - 2000页,你可以简单地使用javascript进行搜索。


使用数组来存储你的数据,这将是使用,可用于

搜索过程;


Ex。 var data = new Array();


data [content] = new Array();


data [content] [0] = [" x.html","关键字","关键字1","关键字2" ...

" keywordn"];

__________________________________________________ ______________________________

< script language =" javascript">

//作者:Baryt?UHADAR,许可证:GPL ..

var c = new String(window.location); // http://foo.com/x.php?q=keyword

var s = c.split(" ="); //在=之后获取关键字

var flag = 0;


if(s [1])

{

s [1] = decodeURI(s [1]);


for(var i = 0; i< 3; i ++)
$ j $ 0; j< site_data [" content] [i] [" keywords"]。长度;

j ++)

if(site_data [" content"] [i] [" keywords"] [j] .match(s [1]))

{

document.write("< a href =" + site_data [" content"] [i] [0]

[0] +" >" + site_data [" content"] [i] [0] [1] +"< / a>");

document.write("< br> ;");

document.write(site_data [" content"] [i] [0] [2]);

document.write("< ; br>");

document.write("< br>");

flag = 1;

}

else if(flag!= 1){flag = 2;}

}

if(flag == 2)

{

document.write(找不到任何东西);

}

}

else if(flag == 0){document.write("输入要搜索的内容);}


< / script>

__________________________________________________ _____________________ <当你通过一个循环在关键字中搜索时,你可以简单地构建一个简单的js搜索引擎骨架.b / b



If i unterstood correctly, you do not have too much content right.
ex. if you do not have much than 1500 - 2000 pages, you can simple
use javascript for search.

use arrays to store your data, which will be used, available for
search process;

Ex. var data = new Array();

data[content] = new Array();

data[content][0] = ["x.html","keyword","keyword1","keyword2" ...
"keywordn"];
__________________________________________________ ______________________________
<script language="javascript">
// Author: Baryt ?UHADAR, Licence: GPL..
var c = new String(window.location); // http://foo.com/x.php?q=keyword
var s = c.split("="); // gets the keyword after "="
var flag = 0;

if(s[1])
{
s[1]=decodeURI(s[1]);

for(var i = 0; i < 3; i++)
{
for(var j = 0; j < site_data["content"][i]["keywords"].length;
j++)
if(site_data["content"][i]["keywords"][j].match(s[1]))
{
document.write("<a href="+site_data["content"][i][0]
[0]+">"+site_data["content"][i][0][1]+"</a>");
document.write("<br>");
document.write(site_data["content"][i][0][2]);
document.write("<br>");
document.write("<br>");
flag = 1;
}
else if(flag !=1) { flag = 2;}
}
if(flag == 2)
{
document.write("nothing found");
}
}
else if(flag == 0) { document.write("enter something to search");}

</script>
__________________________________________________ _____________________

when you search within keywords by a loop, you can simply built a
simple js search engine skeleton.



这样一个重要的网站功能不应该依赖于JavaScript,这可以禁用或不可用
。另外,当提供内容为
application / xhtml + xml时,document.write()不是一个选项,你需要

使用DOM操作。


-

柯蒂斯

Such an important site feature shouldn''t rely upon JavaScript, which
can be disabled or unavailable. Also, when serving content as
application/xhtml+xml, document.write() is not an option, you need to
use DOM manipulation.

--
Curtis


这篇关于在我的页面中添加搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆