<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      站內搜索腳本例子二(JavaScript)

      [摘要]腳本說明: 把如下代碼加入<body>區域中 <script language="javascript"> var key = ""; function makeEntry () this.Date = ""; t...

      腳本說明:
      把如下代碼加入<body>區域中
      <script language="javascript">
      var key = "";

      function makeEntry (){
      this.Date = "";
      this.Name="";
      this.URL = "";
      this.Desc = "";
      this.Category = "";
      return this;
      }

      function makeArray(n) {
      this.length = n;
      for (var k = 1; k <= n; k++) {
      this[k] = "";
      }
      return this;
      }

      function makeLinks(size) {
      this.length = size;
      for (var r=1; r<= size; r++) {
      this[r] = new makeEntry();
      this[r].Date = datesArray[r];
      this[r].Name = namesArray[r];
      this[r].URL = urlsArray[r];
      this[r].Desc = descArray[r];
      }
      return this;
      }


      var linksize=0

      datesArray = new makeArray(linksize);
      namesArray = new makeArray(linksize);
      urlsArray = new makeArray(linksize);
      descArray = new makeArray(linksize);


      var arraycount=0


      arraycount += 1
      datesArray[arraycount] = "5/30/2000"
      urlsArray[arraycount] = "http://www.163.net"
      namesArray[arraycount] = "網易"
      descArray[arraycount] = "163 netease yeah 126 chinese "
      //alert(arraycount)

      arraycount += 1
      datesArray[arraycount] = "5/30/2000 "
      urlsArray[arraycount] = "http://www.sina.com.cn"
      namesArray[arraycount] = "新浪網"
      descArray[arraycount] = "sina net chat chatting news super"
      //alert(arraycount)

      arraycount += 1
      datesArray[arraycount] = "5/30/2000 "
      urlsArray[arraycount] = "http://www.sohu.com"
      namesArray[arraycount] = "搜狐"
      descArray[arraycount] = "sohu net chat news "
      //alert(arraycount)

      linksize = arraycount;

      // ----end data -------

      function showAll(linkobj) {
      for (var s=1; s<= linkobj.length; s++) {
      showLink(linkobj,s);
      }
      }

      function showLink (links, index) {
      //document.write("<table border>");
      document.write("<tr><td>" + links[index].Date +"</td>");
      document.write("<td><a href=" + links[index].URL +">" + links[index].Name + "</a></td>");
      document.write("<td>" + links[index].Desc + "</td></tr>");
      //document.write("</table>");
      }

      function searchLinks(links, keyword){
      document.write("搜尋結果: " +keyword +"<br>");

      document.write("<table border>");
      for (var q=1; q<=links.length; q++) {
      //document.write(q+".")
      if (links[q].URL.indexOf(keyword) != -1){
      // document.write("Search Results for keyword: "+keyword+ "<br>" +links[q].Name +"<p>")
      //document.write("搜尋結果: "+keyword+ "<br>" );
      showLink(links,q);
      continue;
      }
      if (links[q].Desc.indexOf(keyword) != -1) {
      showLink(links,q);
      continue;
      }
      if (links[q].Date.indexOf(keyword) != -1) {
      showLink(links,q);
      continue;
      }
      if (links[q].Name.indexOf(keyword) != -1) {
      showLink(links,q);
      continue;
      }
      }
      document.write("</table>");
      }


      // final stuff
      // the main program ---

      jsi = new makeLinks(linksize);
      document.write("<title>站內查詢</title>");
      searchLinks(jsi, prompt("輸入查詢關鍵字:","輸入查詢關鍵字:"));
      document.write("<hr>");
      document.write("按<b>search again</b>再次查詢<hr>");
      document.write("<form><input type=button onClick='history.go(0)' value='Search Again'></form>");

      // show all the links
      //document.write("<table border>");
      //showAll(jsi);
      //document.write("</table>");

      </script>




      日韩精品一区二区三区高清