xujiaci

为你的blog添加搜索功能

2006-09-18 21:33  Jacky_Xu  阅读(227)  评论(0编辑  收藏  举报

csdn中的blog本身没有提供搜索功能,但我们可以使用google来进行搜索。

具体的办法是将下面的代码添加到公告里面。


<SCRIPT type=text/javascript>
<!--

function myclick() {
 window.open("http://www.google.com/search?as_sitesearch=http://blog.csdn.net/fengfangfang&as_q=" + getObject("as_q").value );
}
// -->
</SCRIPT>
<font size=1> &nbsp;
<input type="text" name="as_q" size="10" ID="as_q">
<input type="button" name="btnG" value="搜索" onclick="myclick();">
</font>

其中的 http://blog.csdn.net/fengfangfang 改成你自己的blog地址。其中的getObject函数是CSDN的blog自带的,其代码如下(不必加到公告里):
function getObject(objectId)
{
 if(document.getElementById)
 {
  return document.getElementById(objectId)
 }
 else if(document.all&&document.all(objectId))
 {
  return document.all(objectId)
 }
 else
 {
  return false
 }
}

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-01
  • 2022-12-23
  • 2021-11-21
  • 2021-07-03
  • 2021-10-14
猜你喜欢
  • 2022-01-13
  • 2021-08-28
  • 2022-12-23
  • 2021-10-25
  • 2021-12-18
  • 2021-04-08
相关资源
相似解决方案