<div id=article><img height="800" alt="" width="1280" src="/down/js/images/12498880470.jpg" /></div>
<script type="text/javascript" >

//缩放图片到合适大小
function ResizeImages()
{
   var myimg,oldwidth,oldheight;
   var maxwidth=550;
   var maxheight=880
   var imgs = document.getElementById('article').getElementsByTagName('img');   //如果你定义的id不是article,请修改此处

   for(i=0;i<imgs.length;i++){
     myimg = imgs[i];

     if(myimg.width > myimg.height)
     {
         if(myimg.width > maxwidth)
         {
            oldwidth = myimg.width;
            myimg.height = myimg.height * (maxwidth/oldwidth);
            myimg.width = maxwidth;
         }
     }else{
         if(myimg.height > maxheight)
         {
            oldheight = myimg.height;
            myimg.width = myimg.width * (maxheight/oldheight);
            myimg.height = maxheight;
         }
     }
   }
}
//缩放图片到合适大小
ResizeImages();
</script>
最近找点东西,深深体会到了bo-blog自带搜索的不足。无奈于bob沉迷于工口游戏及ero game不可自拔,bo-blog 3.0遥遥无期,在这青黄不接的时候我们能做什么呢?自然是发扬祖先的光荣传统,自己动手丰衣足食,拿起Google Custom Search强奸我们的blog。

===西红柿准备===
1.Google Custom Search申请入口,全中文界面,申请有困难的同学自备新华字典一本。

2.自定义搜索引擎创建成功后依次进入我的搜索引擎->控制面板->代码,点击在 Google 托管的网页上即可得到如下代码

<form action="http://www.google.com/cse" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="~!@##@%#^%DGSDGHT$%^%^&ZS" />
    <input type="text" name="q" size="25" />
    <input type="submit" name="sa" value="搜索" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=cse-search-box&lang=zh-Hans"></script>

其中~!@##@%#^%DGSDGHT$%^%^&ZS为用户识别码,这是我们后面所唯一需要的。

3.从这里开始将要对模板下手,模板的OOXX分为两类:

通用版:适用于搜索模块待在侧边的传统模板

打开模板的elements.php文件,于某个eot;后插入如下内容:

$elements['sideblock_search']=<<<eot
<div class="panel">
<h5 onclick='showhidediv("sidebar_search");'>搜索</h5>
<div class="panel-content" id="sidebar_search" style="display: block">
  <form action="http://www.google.com/cse" id="cse-search-box">
    <input type="hidden" name="cx" value="用户识别码" />
    <input type="text" name="q" class="search-field" style="width:120px;"/>
    <input type="submit" name="sa" value="搜索" class="button"/>
  </form>
</div>
</div>
eot;


其中,用户识别码处请自行替换;文本框宽度120px可根据需要自由修改。

其他类:适用于搜索框跑至header的少数捣蛋分子

For G7 v5
打开模板的elements.php文件,查找
<form method="post" action="visit.php">
进行定位,将    

  <form method="post" action="visit.php">
  <div>
    <input name="job" type="hidden" value="search"/>
    <input name="searchmethod" type="hidden" value="2"/>
    <input name="keyword" type="text" id="search-text" class="keyword" value="输入搜索" onfocus="this.value=''" onfocus="this.value='输入搜索';this.style.color='gray';"/>
  </div>
</form>


替换为    

  <form action="http://www.google.com/cse" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="用户识别码" />
    <input name="q" type="text" id="search-text" class="keyword" value="输入搜索" onfocus="this.value=''" onfocus="this.value='输入搜索';this.style.color='gray';"/>
  </div>
</form>


用户识别码处请自行替换

For BloggingPro
打开模板的elements.php文件,查找
<form method="post" action="visit.php">
进行定位,将    

<form method="post" action="visit.php">
<input name="job" type="hidden" value="search"/>
<input name="searchmethod" type="hidden" value="2"/>
<input name="keyword" type="text" id="search-text" class="keyword"/>
<div id="buttonsearch"><input name="submit" type="image" class="search" title="Search" src="{$template['images']}/transparent.gif" alt="Search" value="Go" /></div>
</form>

替换为

<form action="http://www.google.com/cse" id="cse-search-box">
    <input type="hidden" name="cx" value="用户识别码" />
    <input  name="q" type="text" id="search-text" class="keyword"/>
    <div id="buttonsearch"><input name="sa" type="image" class="search" title="Search" src="{$template['images']}/transparent.gif" alt="Search" value="Go" /></div>
</form>

用户识别码处请自行替换

更多修改请举一反三,拿起皮鞭SM你的大脑
外汇 有效 ¥17.83 - ¥26.74

美容 有效 ¥5.45 - ¥6.81

印刷 有效 ¥2.11 - ¥3.09

广告 有效 ¥0.54 - ¥0.94

性病 有效 ¥0.68 - ¥1.13

成人用品 有效 ¥0.56 - ¥0.93

鲜花 有效 ¥4.12 - ¥5.18

健康 有效 ¥0.50 - ¥0.98

彩票 有效 ¥0.22 - ¥0.39

杀毒 有效 ¥0.65 - ¥0.68

游戏 有效 ¥0.52 - ¥0.90

乙肝 有效 ¥3.79 - ¥5.68

女人 有效 ¥0.22 - ¥0.40

婚庆 有效 ¥1.84 - ¥2.63

建材 有效 ¥0.71 - ¥1.19

汽车 有效 ¥0.60 - ¥1.00

电子 有效 ¥0.28 - ¥0.53

电脑 有效 ¥1.03 - ¥1.71

健康 有效 ¥0.50 - ¥0.98

外贸 有效 ¥0.67 - ¥1.26

学习 有效 ¥0.32 - ¥0.43

投资 有效 ¥0.93 - ¥1.84

教育 有效 ¥0.50 - ¥0.65

服务器 有效 ¥0.51 - ¥0.96

虚拟主机 有效 ¥5.66 - ¥7.67

电影 有效 ¥0.32 - ¥0.40

域名 有效 ¥4.39 - ¥6.59

<style type="text/css">
img {width:expression(this.width>600?"580px":this.width+"px");}
</style>
</head>
<body>
图片宽度大于600像素都强制显示为580像素宽<br><br>
<div>
<img src="http://d.lanrentuku.com/lanren/wallpaper/wallpaper-0013.jpg" />
</div>
分页: 1/1 第一页 1 最后页 [ 显示模式: 摘要 | 列表 ]