C#代码:GoogleSearchService.cs////////////////引用GOOGLE API//------------------------------------------------------------------------------
// <autogenerated>
//     This code was generated by a tool.
//     Runtime Version: 1.0.3705.0
//
//     Changes to this file may cause incorrect behavior and will be lost if 
//     the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------// 
// This source code was auto-generated by wsdl, Version=1.0.3705.0.
// 
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
namespace ConsoleApplication1
{
/// <res/>
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="GoogleSearchBinding", Namespace="urn:GoogleSearch")]
[System.Xml.Serialization.SoapIncludeAttribute(typeof(ResultElement))]
public class GoogleSearchService : System.Web.Services.Protocols.SoapHttpClientProtocol 
{
    
/// <res/>
public GoogleSearchService() 
{
this.Url = "http://api.google.com/search/beta2";
}
    
/// <res/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
[return: System.Xml.Serialization.SoapElementAttribute("return", DataType="base64Binary")]
public System.Byte[] doGetCachedPage(string key, string url) 
{
object[] results = this.Invoke("doGetCachedPage", new object[] {
   key,
   url});
return ((System.Byte[])(results[0]));
}
    
/// <res/>
public System.IAsyncResult BegindoGetCachedPage(string key, string url, System.AsyncCallback callback, object asyncState) 
{
return this.BeginInvoke("doGetCachedPage", new object[] {
key,
url}, callback, asyncState);
}
    
/// <res/>
public System.Byte[] EnddoGetCachedPage(System.IAsyncResult asyncResult) 
{
object[] results = this.EndInvoke(asyncResult);
return ((System.Byte[])(results[0]));
}
    
/// <res/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public string doSpellingSuggestion(string key, string phrase) 
{
object[] results = this.Invoke("doSpellingSuggestion", new object[] {
key,
phrase});
return ((string)(results[0]));
}
    
/// <res/>
public System.IAsyncResult BegindoSpellingSuggestion(string key, string phrase, System.AsyncCallback callback, object asyncState) 
{
return this.BeginInvoke("doSpellingSuggestion", new object[] {
 key,
 phrase}, callback, asyncState);
}
    
/// <res/>
public string EnddoSpellingSuggestion(System.IAsyncResult asyncResult) 
{
object[] results = this.EndInvoke(asyncResult);
return ((string)(results[0]));
}
    
/// <res/>
[System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:GoogleSearchAction", RequestNamespace="urn:GoogleSearch", ResponseNamespace="urn:GoogleSearch")]
[return: System.Xml.Serialization.SoapElementAttribute("return")]
public GoogleSearchResult doGoogleSearch(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe) 
{
object[] results = this.Invoke("doGoogleSearch", new object[] {
  key,
  q,
  start,
  maxResults,
  filter,
  restrict,
  safeSearch,
  lr,
  ie,
  oe});
return ((GoogleSearchResult)(results[0]));
}
    
/// <res/>
public System.IAsyncResult BegindoGoogleSearch(string key, string q, int start, int maxResults, bool filter, string restrict, bool safeSearch, string lr, string ie, string oe, System.AsyncCallback callback, object asyncState) 
{
return this.BeginInvoke("doGoogleSearch", new object[] {
   key,
   q,
   start,
   maxResults,
   filter,
   restrict,
   safeSearch,
   lr,
   ie,
   oe}, callback, asyncState);
}
    
/// <res/>
public GoogleSearchResult EnddoGoogleSearch(System.IAsyncResult asyncResult) 
{
object[] results = this.EndInvoke(asyncResult);
return ((GoogleSearchResult)(results[0]));
}
} /// <res/>
[System.Xml.Serialization.SoapTypeAttribute("GoogleSearchResult", "urn:GoogleSearch")]
public class GoogleSearchResult 
{
    
/// <res/>
public bool documentFiltering;
    
/// <res/>
public string searchComments;
    
/// <res/>
public int estimatedTotalResultsCount;
    
/// <res/>
public bool estimateIsExact;
    
/// <res/>
public ResultElement[] resultElements;
    
/// <res/>
public string searchQuery;
    
/// <res/>
public int startIndex;
    
/// <res/>
public int endIndex;
    
/// <res/>
public string searchTips;
    
/// <res/>
public DirectoryCategory[] directoryCategories;
    
/// <res/>
public System.Double searchTime;
} /// <res/>
[System.Xml.Serialization.SoapTypeAttribute("ResultElement", "urn:GoogleSearch")]
public class ResultElement 
{
    
/// <res/>
public string summary;
    
/// <res/>
public string URL;
    
/// <res/>
public string snippet;
    
/// <res/>
public string title;
    
/// <res/>
public string cachedSize;
    
/// <res/>
public bool relatedInformationPresent;
    
/// <res/>
public string hostName;
    
/// <res/>
public DirectoryCategory directoryCategory;
    
/// <res/>
public string directoryTitle;
} /// <res/>
[System.Xml.Serialization.SoapTypeAttribute("DirectoryCategory", "urn:GoogleSearch")]
public class DirectoryCategory 
{
    
/// <res/>
public string fullViewableName;
    
/// <res/>
public string specialEncoding;
}}Class1.cs////////////////主程序using System;
using System.IO;namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
ConsoleApplication1.GoogleSearchService a = new ConsoleApplication1.GoogleSearchService();
GoogleSearchResult b = a.doGoogleSearch("eD2A9vlQFHLGnNPZPOLJfQQhOsqYg+Mh",Console.ReadLine(),0,10,false,"",false,"","",""); Console.WriteLine( "搜索关键字 :" + b.searchQuery );
Console.WriteLine( "查询结果数目:" + b.estimatedTotalResultsCount.ToString() );
Console.WriteLine( "搜索所用时间:" + b.searchTime.ToString() );
}
}
}

解决方案 »

  1.   

    谢谢楼上!
    但我不会用c#啊
    刚才下了一个“江南昆虫”的asp,还是看不懂!
    能否用javascript实现呢?!
    google有没有开放的cgi接口啊!!!
    梅老大快来帮我!!!
      

  2.   

    哈哈,其实是一样的啦,那个是用MSSOAPClient组件调的没有这个先进,但是比这个简单许多,再给你写一个咯,:)
      

  3.   

    哈哈,其实是一样的啦,那个是用MSSOAPClient组件调的没有这个先进,但是比这个简单许多,再给你写一个咯,:)
      

  4.   

    按照道理是下面的,这个,但是一直没好用:(,参考一下咯,调用方法基本一样啦。<%set tmp = Server.CreateObject("MSSOAP.SoapClient")tmp.mssoapinit("D:\\GoogleSearch.xml")set res = tmp.doGoogleSearch("eD2A9vlQFHLGnNPZPOLJfQQhOsqYg+Mh","SOAP",0,10,false,"",false,"","","")Response.Write "-" & res.Item(2).text & "-"%>
      

  5.   

    没办法自己傻傻的写,希望在5.Result下面的textarea中得到类似这样
    “已向英特网搜索 啊。   共有 5,700,000 项查询结果 ”
    的东东,大侠来帮我!!!!!!<br>1.Original<input id=input1 type=button value=Get-GB2312 onclick=xxget1()><br>
    <textarea id=xxtext1 style="width: 50%; height: 50%">
    </textarea><br>2.Sort<input id=input2 type=button value=Sort onclick=xxsort2()><br>
    <textarea id=xxtext2 style="width: 50%; height: 50%">
    </textarea><br>3.Encode<input id=input3 type=button value=encodeURIComponent onclick=xxencode3()><br>
    <textarea id=xxtext3 style="width: 50%; height: 50%">
    </textarea><br>4.Search<input id=input4 type=button value=Next onclick=xxsearch4()><br>
    <iframe id=iframe4 src="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" width=50% height=50%></iframe><br>5.Result<input id=input5 type=button value=Result><br>
    <textarea id=xxtext5 style="width: 50%; height: 50%">
    </textarea>
    <script></script>
    <script>
    var xxthetext="" //general string, define value empty 
    //var xxcount=0 //general countfunction xxget1()
    {
      xxthetext=xxtext0.value //get GB2312
      xxtext1.value=xxthetext //put the string to textarea1
    }function xxsort2()
    {
      xxthetext=xxtext1.value //get string of textarea1
      xxthetext=xxthetext.substring(xxthetext.indexOf("01"),xxthetext.length) //del "...GB 2312-80"
      xxthetext=xxthetext.replace(/[^\u4e00-\u9fa5]/g,"") //del if not GB2312
    //  xxthetext=xxthetext.substring(26,xxthetext.length) //del 中...集
      xxtext2.value=xxthetext //put string to textarea2  if(xxtext2.value.length!=6763) //test if 6763 char of GB2312
      {
        alert("string length isn't 6763\n\n text.length="+xxthetext.length)
      }
    }function xxencode3()
    {
      xxthetext=xxtext2.value //get string of textarea2
      xxthetext=encodeURIComponent(xxthetext) //change string to encode
      xxtext3.value=xxthetext //put string to textarea3
      if(xxtext3.value.length!=60867) //test if 6763*9 bytes of GB2312
      {
        alert("string length isn't 60867\n\n text.length="+xxthetext.length)
      }
    }function xxsearch4()
    {
    //  xxthetext=xxtext3.value //get encode
      var xxgoogle
      xxgoogle="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" //empyt search
      xxgoogle=xxgoogle+xxthetext.substring(0,9) //set a search char
      iframe4.location=xxgoogle //run search
      xxthetext=xxthetext.substring(9,xxthetext.length) //del a searched char
    }
    </script><br>
    <textarea id=xxtext0 style="visibility:hidden">
         中华人民共和国国家标准
        信息交换用汉字编码字符集
             基   本   集
              GB 2312-80
    01 0 1 2 3 4 5 6 7 8 9
    0     、 。 · ˉ ˇ ¨ 〃 々
    1 — ~ ‖ … ‘ ’ “ ” 〔 〕
    2 〈 〉 《 》 「 」 『 』 〖 〗
    3 【 】 ± × ÷ ∶ ∧ ∨ ∑ ∏
    4 ∪ ∩ ∈ ∷ √ ⊥ ∥ ∠ ⌒ ⊙
    5 ∫ ∮ ≡ ≌ ≈ ∽ ∝ ≠ ≮ ≯
    6 ≤ ≥ ∞ ∵ ∴ ♂ ♀ ° ′ ″
    7 ℃ $ ¤ ¢ £ ‰ § № ☆ ★
    8 ○ ● ◎ ◇ ◆ □ ■ △ ▲ ※
    9 → ← ↑ ↓ 〓16 0 1 2 3 4 5 6 7 8 9
    0   啊 阿 埃 挨 哎 唉 哀 皑 癌
    1 蔼 矮 艾 碍 爱 隘 鞍 氨 安 俺
    2 按 暗 岸 胺 案 肮 昂 盎 凹 敖
    3 熬 翱 袄 傲 奥 懊 澳 芭 捌 扒
    4 叭 吧 笆 八 疤 巴 拔 跋 靶 把
    5 耙 坝 霸 罢 爸 白 柏 百 摆 佰
    6 败 拜 稗 斑 班 搬 扳 般 颁 板
    7 版 扮 拌 伴 瓣 半 办 绊 邦 帮
    8 梆 榜 膀 绑 棒 磅 蚌 镑 傍 谤
    9 苞 胞 包 褒 剥17 0 1 2 3 4 5 6 7 8 9
    0   薄 雹 保 堡 饱 宝 抱 报 暴
    1 豹 鲍 爆 杯 碑 悲 卑 北 辈 背
    2 贝 钡 倍 狈 备 惫 焙 被 奔 苯
    3 本 笨 崩 绷 甭 泵 蹦 迸 逼 鼻
    4 比 鄙 笔 彼 碧 蓖 蔽 毕 毙 毖
    5 币 庇 痹 闭 敝 弊 必 辟 壁 臂
    6 避 陛 鞭 边 编 贬 扁 便 变 卞
    7 辨 辩 辫 遍 标 彪 膘 表 鳖 憋
    8 别 瘪 彬 斌 濒 滨 宾 摈 兵 冰
    9 柄 丙 秉 饼 炳18 0 1 2 3 4 5 6 7 8 9
    0   病 并 玻 菠 播 拨 钵 波 博
    1 勃 搏 铂 箔 伯 帛 舶 脖 膊 渤
    2 泊 驳 捕 卜 哺 补 埠 不 布 步
    3 簿 部 怖 擦 猜 裁 材 才 财 睬
    4 踩 采 彩 菜 蔡 餐 参 蚕 残 惭
    5 惨 灿 苍 舱 仓 沧 藏 操 糙 槽
    6 曹 草 厕 策 侧 册 测 层 蹭 插
    7 叉 茬 茶 查 碴 搽 察 岔 差 诧
    8 拆 柴 豺 搀 掺 蝉 馋 谗 缠 铲
    9 产 阐 颤 昌 猖19 0 1 2 3 4 5 6 7 8 9
    0   场 尝 常 长 偿 肠 厂 敞 畅
    1 唱 倡 超 抄 钞 朝 嘲 潮 巢 吵
    2 炒 车 扯 撤 掣 彻 澈 郴 臣 辰
    3 尘 晨 忱 沉 陈 趁 衬 撑 称 城
    4 橙 成 呈 乘 程 惩 澄 诚 承 逞
    5 骋 秤 吃 痴 持 匙 池 迟 弛 驰
    6 耻 齿 侈 尺 赤 翅 斥 炽 充 冲
    7 虫 崇 宠 抽 酬 畴 踌 稠 愁 筹
    8 仇 绸 瞅 丑 臭 初 出 橱 厨 躇
    9 锄 雏 滁 除 楚</textarea>
      

  6.   

    有一点进展,代码帖出来:)<br>1.Original<input id=input1 type=button value="Get GB2312" onclick=xxget1();xxscroll()><br>
    <textarea id=xxtext1 style="width: 90%; height: 50%">
    </textarea><br>2.Sort<input id=input2 type=button value="Sort GB2312" onclick=xxsort2();xxscroll()><br>
    <textarea id=xxtext2 style="width: 90%; height: 50%">
    </textarea><br>3.Encode<input id=input3 type=button value=encodeURIComponent onclick=xxencode3();xxscroll()><br>
    <textarea id=xxtext3 style="width: 90%; height: 50%">
    </textarea><br>4.Search<input id=input4 type=button value="Search for 0-6762" onclick=xxsearch4()>
    <input id=input4a>
    <a href="javascript:window.location.reload()">RELOAD to Top</a>
    <br>
    <iframe id=iframe4 src="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" width=90% height=50%></iframe><br>5.Source<input id=input5 type=button value='Get Source' onclick=xxsource5()>
    <input id=input5a size=80>
    <br>
    <textarea id=xxtext5 style="width: 90%; height: 50%">
    </textarea>
    <script>
    var xxthetext="" //general string, define value empty 
    var xxcount=0 //real count
    input4a.value=xxcount/9 //init first value (0-6762)function xxscroll()
    {
      document.body.scrollTop += document.body.clientHeight/2 //scroll half screen
    }function xxget1()
    {
      xxthetext=xxtext0.value //get GB2312
      xxtext1.value=xxthetext //put the string to textarea1
    }function xxsort2()
    {
      xxthetext=xxtext1.value //get string of textarea1
      xxthetext=xxthetext.substring(xxthetext.indexOf("01"),xxthetext.length) //del "...GB 2312-80"
      xxthetext=xxthetext.replace(/[^\u4e00-\u9fa5]/g,"") //del if not GB2312
    //  xxthetext=xxthetext.substring(26,xxthetext.length) //del 中...集
      xxtext2.value=xxthetext //put string to textarea2  if(xxtext2.value.length!=6763) //test if 6763 char of GB2312
      {
        alert("string length isn't 6763\n\n text.length="+xxthetext.length)
      }
    }function xxencode3()
    {
      xxcount=0 //reset the real count
      input4a.value=xxcount/9
      xxthetext=xxtext2.value //get string of textarea2
      xxthetext=encodeURIComponent(xxthetext) //change string to encode
      xxtext3.value=xxthetext //put string to textarea3
      if(xxtext3.value.length!=60867) //test if 6763*9 bytes of GB2312
      {
        alert("string length isn't 60867\n\n text.length="+xxthetext.length)
      }
    }function xxsearch4()
    {
      xxcount=eval(input4a.value)*9 //get current real count
      xxthetext=xxtext3.value //get encode  var xxgoogle //prepare to set "iframe4.outerHTML"
      xxgoogle='<IFRAME id=iframe4 src="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=' //empyt
      xxgoogle=xxgoogle+xxthetext.substring(xxcount,xxcount+9)+'&lr=lang_zh-CN" width=90% height=50%></IFRAME>' //prepare to set "iframe4.outerHTML"
      document.all.iframe4.outerHTML=xxgoogle //change "iframe4.outerHTML" (equal run search)///  var xxgoogle
    ///  xxgoogle="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" //empyt search
    ///  xxgoogle=xxgoogle+xxthetext.substring(xxcount,xxcount+9)+"&lr=lang_zh-CN" //set a search char (prc_cn only)
    ///  iframe4.location=xxgoogle //run search
      xxcount=xxcount+9 //for next char
      input4a.value=xxcount/9 //set the count to input
    }function xxsource5() //use the "function loadContent(strURL)"
    {
      xxtext5.value=loadContent(document.getElementById("iframe4").src) //put source in textarea5  var str="" //temp string
      str=xxtext5.value //get html source
      if(str.indexOf('已搜索有关')>-1&&str.indexOf('项查询结果')>-1) //if found
      {
        str=str.replace(/((.|\n)*已搜索有关)((.|\n)*)(项查询结果(.|\n)*)/g,"$3") //short for source
        str=str.substring(str.indexOf('共有 <b>'),str.length)
        str=str.replace(/((.|\n)*>)((.|\n)*)(<(.|\n)*)/g,"$3") //get the source number:)
      }
      else
      {
        str=":(" //if no found
      }
      input5a.value=str //put the short source to 'input5a'
    }function loadContent(strURL) //I get this code from a friend (used for "function xxsource5()")
    {
    var strContent = "";
    if (typeof strURL != "string" || strURL == "")return strContent;
    try
    {
    var oProxy = new ActiveXObject("Microsoft.XMLHTTP");

    oProxy["Open"]("GET", strURL, false);
    oProxy["Send"]();
    strContent = oProxy["responseText"];
    }
    catch(e){status = e.description}
    return strContent;
    }
    </script><br>
    <textarea id=xxtext0 style="visibility:hidden">
         中华人民共和国国家标准
        信息交换用汉字编码字符集
             基   本   集
              GB 2312-80
    87 0 1 2 3 4 5 6 7 8 9
    0   鳌 鳍 鳎 鳏 鳐 鳓 鳔 鳕 鳗
    1 鳘 鳙 鳜 鳝 鳟 鳢 靼 鞅 鞑 鞒
    2 鞔 鞯 鞫 鞣 鞲 鞴 骱 骰 骷 鹘
    3 骶 骺 骼 髁 髀 髅 髂 髋 髌 髑
    4 魅 魃 魇 魉 魈 魍 魑 飨 餍 餮
    5 饕 饔 髟 髡 髦 髯 髫 髻 髭 髹
    6 鬈 鬏 鬓 鬟 鬣 麽 麾 縻 麂 麇
    7 麈 麋 麒 鏖 麝 麟 黛 黜 黝 黠
    8 黟 黢 黩 黧 黥 黪 黯 鼢 鼬 鼯
    9 鼹 鼷 鼽 鼾 齄
    </textarea>
      

  7.   

    终于写出来了!谢谢大家!!!
    <title>tested on windows2000server & ie6build2800</title><input id=input0 type=button value="Automatic! It may take half minutes, Press Stop if need!" onclick=xxauto()><input id=xxautoi value=10><br>1.Original<input id=input1 type=button value="Get GB2312" onclick=xxget1();xxdown()><br>
    <textarea id=xxtext1 style="width: 90%; height: 50%">
    </textarea><br>2.Sort<input id=input2 type=button value="Sort GB2312" onclick=xxsort2();xxdown()><br>
    <textarea id=xxtext2 style="width: 90%; height: 50%">
    </textarea><br>3.Encode<input id=input3 type=button value=encodeURIComponent onclick=xxencode3();xxdown()><br>
    <textarea id=xxtext3 style="width: 90%; height: 50%">
    </textarea><br>4.Search<input id=input4 type=button value="STEP.A. Search for 0-6762" onclick=xxsearch4();xxdown()>
    <input id=input4a>
    <a href="javascript:window.location.reload()">RELOAD to Top</a>
    <br>
    <iframe id=iframe4 src="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" width=90% height=50%></iframe><br>5.Source<input id=input5 type=button value='STEP.B. Get Source' onclick=xxsource5();xxdown()>
    <input id=input5a>
    <a href="javascript:window.location.reload()">RELOAD to Top</a>
    <br>
    <textarea id=xxtext5 style="width: 90%; height: 50%">
    </textarea><br>6.Result<input id=input6 type=button value='STEP.C. Result TOTOLE LINE:6763' onclick=xxresult6();xxup()>
    <input id=input6a>
    <a href="javascript:window.location.reload()">RELOAD to Top</a>
    <br>
    <textarea id=xxtext6 style="width: 90%; height: 50%">
    </textarea>
    <script>
    var xxdebug //set debug window
    var xxthetext="" //general string, define value empty 
    var xxcount=0 //real count
    input4a.value=xxcount/9 //init first value (0-6762)
    function xxget1()
    {
      xxthetext=xxtext0.value //get GB2312
      xxtext1.value=xxthetext //put the string to textarea1
    }function xxsort2()
    {
      xxthetext=xxtext1.value //get string of textarea1
      xxthetext=xxthetext.substring(xxthetext.indexOf("01"),xxthetext.length) //del "...GB 2312-80"
      xxthetext=xxthetext.replace(/[^\u4e00-\u9fa5]/g,"") //del if not GB2312
      xxtext2.value=xxthetext //put string to textarea2  if(xxtext2.value.length!=6763) //test if 6763 char of GB2312
      {
        xxdebug = open("","DEBUG_WIN") //write debug info
        xxdebug.document.write("----------xxtext2 (Warning)----------<br>")
        xxdebug.document.write("Right string length :6763<br>Currnet :"+xxthetext.length+"<br>")
        xxdebug.document.write("----------<a href='javascript:close()'>Close</a>----------<br>")
        xxdebug.document.title="DEBUG_WIN" //show title
        xxdebug.document.body.scrollTop=xxdebug.document.body.scrollHeight //scroll down to bottom
        xxdebug.focus() //display on top
      }
    }function xxencode3()
    {
      xxcount=0 //reset the real count
      input4a.value=xxcount/9
      xxthetext=xxtext2.value //get string of textarea2
      xxthetext=encodeURIComponent(xxthetext) //change string to encode
      xxtext3.value=xxthetext //put string to textarea3
      if(xxtext3.value.length!=60867) //test if 6763*9 bytes of GB2312
      {
        xxdebug = open("","DEBUG_WIN") //write debug info
        xxdebug.document.write("----------xxtext3 (Warning)----------<br>")
        xxdebug.document.write("Right string length :60867<br>Currnet :"+xxthetext.length+"<br>")
        xxdebug.document.write("----------<a href='javascript:close()'>Close</a>----------<br>")
        xxdebug.document.title="DEBUG_WIN" //show title
        xxdebug.document.body.scrollTop=xxdebug.document.body.scrollHeight //scroll down to bottom
        xxdebug.focus() //display on top
      }
    }function xxsearch4()
    {
      xxcount=eval(input4a.value)*9 //get current real count
      xxthetext=xxtext3.value //get encode  var xxgoogle //prepare to set "iframe4.outerHTML"
      xxgoogle='<IFRAME id=iframe4 src="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=' //empyt
      xxgoogle=xxgoogle+xxthetext.substring(xxcount,xxcount+9)+'&lr=lang_zh-CN" width=90% height=50%></IFRAME>' //prepare to set "iframe4.outerHTML"
      document.all.iframe4.outerHTML=xxgoogle //change "iframe4.outerHTML" (equal run search)///  var xxgoogle
    ///  xxgoogle="http://www.google.com/search?hl=zh-CN&ie=UTF-8&oe=UTF-8&q=" //empyt search
    ///  xxgoogle=xxgoogle+xxthetext.substring(xxcount,xxcount+9)+"&lr=lang_zh-CN" //set a search char (prc_cn only)
    ///  iframe4.location=xxgoogle //run search
      xxcount=xxcount+9 //for next char
      input4a.value=xxcount/9 //set the count to input
    }function xxsource5() //use the "function loadContent(strURL)"
    {
      xxtext5.value=loadContent(document.getElementById("iframe4").src) //put source in textarea5  var str="" //temp string
      str=xxtext5.value //get html source
      if(str.indexOf('共有')>-1&&str.indexOf('项查询结果')>-1) //if found
      {
        str=str.replace(/((.|\n)*共有)((.|\n)*)(项查询结果(.|\n)*)/g,"$3") //short for source
    //    str=str.substring(str.indexOf('共有 <b>'),str.length)
        str=str.replace(/((.|\n)*>)((.|\n)*)(<(.|\n)*)/g,"$3") //get the source number in <br></br>:)
      }
      else if(str.indexOf('太常用,没有被列入搜索范围。')>-1) //if most frequency
      {
        str="太常用" //if most frequency
      }
      else
      {
        str=":(" //if no found
      }
      input5a.value=str //put the short source to 'input5a'
    }
      

  8.   


    function xxresult6() //get result list
    {
      xxthetext=xxtext2.value //get GB2312 text
      xxtext6.value=xxtext6.value+xxthetext.charAt(input4a.value)+'\t'+input5a.value+'\n' //get current full result to xxtext6
      input6a.value=xxtext6.value.split('\n').length-1 //totol line
      xxtext6.scrollTop=xxtext6.scrollHeight //scroll down to bottom  if(input6a.value!=input4a.value)
      {
        xxdebug = open("","DEBUG_WIN") //write debug info
        xxdebug.document.write("----------input6a (Warning)----------<br>")
        xxdebug.document.write("Right lines :"+input4a.value+"<br>Currnet :"+input6a.value+"<br>")
        xxdebug.document.write("----------<a href='javascript:close()'>Close</a>----------<br>")
        xxdebug.document.title="DEBUG_WIN" //show title
        xxdebug.document.body.scrollTop=xxdebug.document.body.scrollHeight //scroll down to bottom
        xxdebug.focus() //display on top
      }
    }function loadContent(strURL) //I get this code from a friend (used for "function xxsource5()")
    {
    var strContent = "";
    if (typeof strURL != "string" || strURL == "")return strContent;
    try
    {
    var oProxy = new ActiveXObject("Microsoft.XMLHTTP");

    oProxy["Open"]("GET", strURL, false);
    oProxy["Send"]();
    strContent = oProxy["responseText"];
    }
    catch(e){status = e.description}
    return strContent;
    }function xxdown()
    {
      document.body.scrollTop += document.body.clientHeight/2 //scroll down half screen
    }function xxup()
    {
      document.body.scrollTop -= document.body.clientHeight //scroll up a screen
    }function window.onbeforeunload()
    {
      xxdebug.close()
    }function xxauto()
    {
      xxget1()
      xxsort2()
      xxencode3()  for(i=xxautoi.value;i>0;i--) //run demo to get 6763 char(or from xxautoi.value), a long time
      {
        xxsearch4()
        xxsource5()
        xxresult6()    if(xxautoi.value>10) //stop from sub win (set largest finder)
        {
          i=0 //stop
        }    xxdebug = open("","DEBUG_WIN") //write output info
        xxdebug.document.write("----------xxauto (Result)----------<br>")
        xxdebug.document.write(xxtext6.value+"<br>")
        xxdebug.document.write("----------<a href='javascript:opener.document.all.xxautoi.value=10+1'>Stop</a>----------<br>") //stop all, write to sub win (set largest finder)
        xxdebug.document.close() //close & prepare to open next output
        xxdebug.document.title="DEBUG_WIN" //show title
        xxdebug.document.body.scrollTop=xxdebug.document.body.scrollHeight //scroll down to bottom
        xxdebug.focus() //display on top
      }  document.body.scrollTop=document.body.scrollHeight //scroll down to bottom
      focus() //return to main win
    }</script><br>
    <textarea id=xxtext0 style="visibility:hidden">
         中华人民共和国国家标准
        信息交换用汉字编码字符集
             基   本   集
              GB 2312-80
    87 0 1 2 3 4 5 6 7 8 9
    0   鳌 鳍 鳎 鳏 鳐 鳓 鳔 鳕 鳗
    1 鳘 鳙 鳜 鳝 鳟 鳢 靼 鞅 鞑 鞒
    2 鞔 鞯 鞫 鞣 鞲 鞴 骱 骰 骷 鹘
    3 骶 骺 骼 髁 髀 髅 髂 髋 髌 髑
    4 魅 魃 魇 魉 魈 魍 魑 飨 餍 餮
    5 饕 饔 髟 髡 髦 髯 髫 髻 髭 髹
    6 鬈 鬏 鬓 鬟 鬣 麽 麾 縻 麂 麇
    7 麈 麋 麒 鏖 麝 麟 黛 黜 黝 黠
    8 黟 黢 黩 黧 黥 黪 黯 鼢 鼬 鼯
    9 鼹 鼷 鼽 鼾 齄
    </textarea>
    终于写出来了!谢谢大家!!!
      

  9.   

    这两段代码帖在一个HTML中就好用,大家可以试试:)