⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d0003.htm

📁 JavaScript源代码全集
💻 HTM
📖 第 1 页 / 共 2 页
字号:
          <br>
          <input name="submit" onclick="validate_form()" type="button" value="搜索" style="font-size: 9pt; background-color: rgb(128,128,192); color: rgb(255,255,160)"> <input name="reset" type="reset" value="清除" style="font-size: 9pt; background-color: rgb(128,128,192); color: rgb(255,255,160)"> </b></font></span></p>
          </center></div>
        </form>
        </td>
        <td width="17%" valign="middle" align="center" height="22"></td>
      </tr>
      <tr>
        <td width="16%" valign="middle" align="center" height="20"></td>
        <td width="67%" valign="middle" align="center" height="20"><span style="font-size: 9pt; color: rgb(255,0,0)">拷贝下面的代码到你的html文件的&lt;body&gt;和&lt;/body&gt;之间</span></td>
        <td width="17%" valign="middle" align="center" height="20"></td>
      </tr>
      <tr>
        <td width="16%" valign="middle" align="center" height="22"></td>
        <td width="67%" valign="middle" align="center" height="22" bgcolor="#F0FAFF"><span style="font-size: 9pt"><form name="copy1">
          <p><textarea rows="10" name="S1" cols="40" onMouseOver="this.focus()" onFocus="this.select()"><!-- 以下不要改变 --> &lt;script language=&quot;JavaScript&quot;&gt;
      var key = &quot;&quot;;
      function makeEntry ()
      {
          this.Name=&quot;&quot;;
          this.URL = &quot;&quot;;
          this.Desc = &quot;&quot;;
          return this;
      }

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

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

var linksize=0; 

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


var arraycount=0; 

<!-- 以下是数据库部分,随意添加和删除-->
arraycount += 1
urlsArray[arraycount] = &quot;http://www.tasoo.2000c.net&quot;
namesArray[arraycount] = &quot;天索星网&quot;
descArray[arraycount] = &quot; 娱乐 音乐 艺术 时事 新闻 书库 免费资源 主页制作技巧 搜索引擎 插件 教学 动态页面 图形图象 多媒体&quot;

arraycount += 1
urlsArray[arraycount] = &quot;http://tasoo.in-china. com&quot;
namesArray[arraycount] = &quot;tasoo starnet&quot;
descArray[arraycount] = &quot;java  flash  photoshop  html  javascript  GIF&quot;


linksize = arraycount;

function searchLinks(links, keyword, hits, dirw)
{
        var resultcount=0;
<!-- 如下是生成查询结果显示页面!外观自己可以修改相应代码即可! -->
        document.write('&lt;HTML&gt;');
        document.write('&lt;BODY BGCOLOR=#C0C0C0 TEXT=#FF0080 LINK=black VLINK=yellow ALINK=yellow&gt;');
        document.write('&lt;CENTER&gt;&lt;TABLE BORDER=3 CELLSPACING=0 CELLPADDING=3  BGCOLOR=\&quot;#ff0000\&quot;&gt;&lt;TR&gt;&lt;TD&gt;');
        document.write(&quot;&lt;CENTER&gt;&lt;font color=white&gt;查寻结果 &lt;/font&gt;&lt;font size=1 color=yellow&gt;&quot; +keyword +&quot;&lt;/font&gt;&lt;/CENTER&gt;&quot;);
        document.write('&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/CENTER&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/CENTER&gt;&lt;P&gt;');
        document.write('&lt;OL&gt;');
        for (var q=1; q&lt;=links.length; q++)
        {
            if (links[q].URL.toLowerCase().indexOf(dirw) != -1)
            {
                if (links[q].Desc.toLowerCase().indexOf(keyword) != -1)
                {
                    resultcount += 1;
                    if (resultcount &gt; hits)
                    {
                        break;
                    }
                    else
                    {
                        document.write(&quot;&lt;LI&gt;&quot;);
                        document.write(&quot;&lt;a href=\&quot;&quot; + links[q].URL + &quot;\&quot;&gt;&quot; + links[q].Name + &quot;&lt;/a&gt;&quot;);
                        document.write(&quot; -&quot; + links[q].Desc + &quot;&lt;br&gt;&quot;);
                        continue;
                    }
                }
                if (links[q].Name.toLowerCase().indexOf(keyword) != -1)
                {
                   resultcount += 1;
                   if (resultcount &gt; hits)
                   {
                       break;
                   }
                   else
                   {
                        document.write(&quot;&lt;LI&gt;&quot;);
                        document.write(&quot;&lt;a href=\&quot;&quot; + links[q].URL + &quot;\&quot;&gt;&quot; + links[q].Name + &quot;&lt;/a&gt;&quot;);
                        document.write(&quot; -&quot; + links[q].Desc + &quot;&lt;br&gt;&quot;);
                        continue;
                   }
                }
            }
        }                                       

}

&lt;/script&gt; &lt;script&gt;
<!-- 如下是表单合法性检查,主要是避免一些非法字符的查询! -->
function validate_form()
{
  txt = document.form.search.value;
  newindex = document.form.numhits.selectedIndex;
  dahits = document.form.numhits[newindex].value;
  newindexb = document.form.whichdir.selectedIndex;
  dadir = document.form.whichdir[newindexb].value;
  if (txt.indexOf(&quot;.&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '.'&quot;); return;}
  if (txt.indexOf(&quot;,&quot;) != -1){
        alert(&quot;Search is invalid! Contains a ','&quot;); return;}
  if (txt.indexOf(&quot;@&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '@''&quot;); return;}
  if (txt.indexOf(&quot;!&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '!''&quot;); return;}
  if (txt.indexOf(&quot;#&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '#''&quot;); return;}
  if (txt.indexOf(&quot;$&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '$''&quot;); return;}
  if (txt.indexOf(&quot;%&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '%''&quot;); return;}
  if (txt.indexOf(&quot;^&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '^''&quot;); return;}
  if (txt.indexOf(&quot;&amp;&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '&amp;''&quot;); return;}
  if (txt.indexOf(&quot;*&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '*''&quot;); return;}
  if (txt.indexOf(&quot;(&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '(''&quot;); return;}
  if (txt.indexOf(&quot;)&quot;) != -1){
        alert(&quot;Search is invalid! Contains a ')''&quot;); return;}
  if (txt.indexOf(&quot;[&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '[''&quot;); return;}
  if (txt.indexOf(&quot;]&quot;) != -1){
        alert(&quot;Search is invalid! Contains a ']''&quot;); return;}
  if (txt.indexOf(&quot;;&quot;) != -1){
        alert(&quot;Search is invalid! Contains a ';''&quot;); return;}
  if (txt.indexOf(&quot;:&quot;) != -1){
        alert(&quot;Search is invalid! Contains a ':''&quot;); return;}
  if (txt.indexOf(&quot;&lt;&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '&lt;''&quot;); return;}
  if (txt.indexOf(&quot;&gt;&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '&gt;''&quot;); return;}
  if (txt.indexOf(&quot;?&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '?''&quot;); return;}
  if (txt.indexOf(&quot;=&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '=''&quot;); return;}
  if (txt.indexOf(&quot;+&quot;) != -1){
        alert(&quot;Search is invalid! Contains a '+''&quot;); return;}
  else
      {
        jsi = new makeLinks(linksize);
        searchLinks(jsi, txt, dahits, dadir);
        document.write('&lt;/OL&gt;');
        document.write('&lt;font color=red&gt;....... 查询结果结束 .......&lt;/font&gt;&lt;P&gt;');
        document.write('&lt;hr&gt;');
        document.write('&lt;/body&gt;&lt;/html&gt;');
   }

}
&lt;/script&gt; <!-- 脚本到此结束! -->&lt;font
size=&quot;2&quot;&gt;&lt;br&gt;
&lt;/font&gt;&lt;/p&gt;

&lt;table align=&quot;center&quot; border=&quot;1&quot; cellPadding=&quot;0&quot; cellSpacing=&quot;0&quot; width=&quot;59%&quot; valign=&quot;top&quot;&gt;
&lt;TBODY&gt;
  &lt;tr&gt;
    &lt;td align=&quot;left&quot; bgColor=&quot;#ffffff&quot; height=&quot;232&quot; width=&quot;100%&quot;&gt;&lt;form name=&quot;form&quot;&gt;
      &lt;font color=&quot;black&quot;&gt;&lt;div align=&quot;center&quot;&gt;&lt;center&gt;&lt;p&gt;&lt;span style=&quot;font-size: 9pt&quot;&gt;关键字(小写字符,支持中文):&lt;/font&gt; 
      &lt;font color=&quot;black&quot;&gt;&lt;b&gt;&lt;input name=&quot;search&quot; size=&quot;20&quot;&gt; &lt;br&gt;
      &lt;/b&gt;返回记录数:&lt;/font&gt; &lt;font color=&quot;black&quot;&gt;&lt;select name=&quot;numhits&quot; size=&quot;1&quot;&gt;
        &lt;option selected value=&quot;25&quot;&gt;25&lt;/option&gt;
        &lt;option value=&quot;50&quot;&gt;50&lt;/option&gt;
        &lt;option value=&quot;75&quot;&gt;75&lt;/option&gt;
        &lt;option value=&quot;100&quot;&gt;100&lt;/option&gt;
        &lt;option value=&quot;150&quot;&gt;150&lt;/option&gt;
        &lt;option value=&quot;200&quot;&gt;200&lt;/option&gt;
      &lt;/select&gt; 检索分类 &lt;b&gt;&lt;select class=&quot;pt9&quot; name=&quot;whichdir&quot; size=&quot;1&quot;&gt;
        &lt;option selected value=&quot;http&quot;&gt;ALL&lt;/option&gt;
        &lt;option value=&quot;java&quot;&gt;javaScript&lt;/option&gt;
        &lt;option value=&quot;inet&quot;&gt;Internet&lt;/option&gt;
        &lt;option value=&quot;tools&quot;&gt;System Tools&lt;/option&gt;
      &lt;/select&gt; &lt;br&gt;
      &lt;br&gt;
      &lt;input name=&quot;submit&quot; onclick=&quot;validate_form()&quot; type=&quot;button&quot; value=&quot;Search&quot;&gt; &lt;input
      name=&quot;reset&quot; type=&quot;reset&quot; value=&quot; Clear &quot;&gt; &lt;/b&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
      &lt;/center&gt;&lt;/div&gt;
    &lt;/form&gt;
 --&gt;</textarea></span></p>
        </form>
        </td>
        <td width="17%" valign="middle" align="center" height="22"></td>
      </tr>
    </table>
    </center></div></td>
  </tr>
  <tr>
    <td width="20%" bgcolor="#FFFFFF" valign="middle" align="center" height="20"></td>
    <td width="60%" height="20"></td>
    <td width="20%" height="20"></td>
  </tr>
  <tr>
    <td width="20%" bgcolor="#FFFFFF" valign="middle" align="center"></td>
    <td width="60%" height="10"><p align="center"><span style="font-size: 9pt"><a href="d0002.htm">上一页</a> &nbsp;&nbsp;&nbsp; <a href="d0004.htm">下一页</a></span></td>
    <td width="20%"></td>
  </tr>
  <tr>
    <td width="20%" bgcolor="#FFFFFF" valign="middle" align="center"></td>
    <td width="60%" height="10"></td>
    <td width="20%"></td>
  </tr>
  <tr>
    <td width="20%" bgcolor="#FFFFFF" valign="middle" align="center"></td>
    <td width="60%" height="10"></td>
    <td width="20%"></td>
  </tr>
  <tr>
    <td width="20%" bgcolor="#FFFFFF" valign="middle" align="center"></td>
    <td width="60%"><div align="center"><center><table cellspacing="0" cellpadding="0">
      <tr>
        <td width="100%"><p align="center"><font color="#969696"><span style="font-size: 9pt">《天索星网》 
        星网制作 版权所有</span></font></td>
      </tr>
      <tr>
        <td width="100%"><p align="center"><font color="#969696"><span style="font-size: 9pt; font-family: Arial">&copy;2000-2001 All Rights Reserved</span></font></td>
      </tr>
      <tr>
        <td width="100%"></td>
      </tr>
    </table>
    </center></div></td>
    <td width="20%"></td>
  </tr>
</table>
</center></div>
</body>
</html>
<!--Saved  from天索星网  版权所有;http://www.tasoo.2000c.net,E-mail:tasoo_cn@yahoo.com.cn-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -