JavaScript DHTML/Ajax Layer/Search Engine

Материал из Web эксперт
Перейти к: навигация, поиск

Do a search on different search engine at the same time

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Search multiple engines</title>
  <link rel="shortcut icon" href="/images/favicon.ico" />
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <meta name="keywords" content="search,google,yahoo,alltheweb,msn,wiki,ivar,abrahamsen">
  <meta name="description" content="search enginer page">
  <style type="text/css">
  /**************************
  Copyright         : electric ray
  Filename         : search.css
  Created          : 2004-05-20  10:03  :  ivar
  Last Updated     : 2004-05-20  10:03 :  ivar
  Version          :  0 . 01
  Comments         :
**************************/
#wrapper{
}
#wrapper > tr > td {
  text-align: center;
}
#main{
  border: 3px outset silver;
  background-color: #99ccff;
}
#main > tr > td{
  padding: 5px;
  font: bold 10pt "Comic Sans", Sans, Tahoma;
  text-align: center;
}
#main td{
  padding: 5px;
}
#main .logo{
   width: 20px;
}
#main td#title{
  font-size: 18pt;
  text-align: center;
  /*width: 100%;*/
}
#main #searches {
}
#main #searches td{
  white-space: nowrap;
}
#main #searches ul{
}
#main #searches li{
  list-style: none;
}
#main td#submit{
  text-align: center;
}
#main input#submit{
  background-color: #ffcc99;
  width: 400px;
  font: bold 12pt "Comic Sans", Sans, Tahoma;
   border: 2px groove red;
}
    </style>
  <script language="JavaScript" type="text/javascript">
/**************************
  Copyright         : electric ray
  Filename         : search.js
  Created          : 2004-05-20  10:03  :  ivar
  Last Updated     : 2004-05-20  10:03 :  ivar
  Version          :  0 . 01
  Comments         :
**************************/
//###### mini functions
function changeAction( form, what ){
  form.action = what;
}
function goSearch(){
  //return false;
  return true;
}
//###### Objects
//############################
//# function : SearchEngine
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function SearchEngine(){
  //## methods
  this.run = engineRun;
  this.close = engineClose;
  this.spliter = engineSplit;
  this.build = engineBuild;
  this.addURL = engineAddURL;
  this.frame = engineFrame;
  this.setTMPL = engineTMPL;
  //## variables
  this.search = "";
  this.params = "";
  this.engines = "";
  this.urls = new Array();
  this.tmpl =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><html><head></head>"
    +  "::FRAMES::"
    + "</HTML>";
}
//###### Methods
//############################
//# function : engineRun
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineRun(){
  this.spliter();
  this.build();
}
//############################
//# function : engineSplit
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineSplit(){
  this.params = new Array();
  this.engines = new Array();
  this.search = location.search.substring(1);
  this.tprm = this.search.split("&");
  for ( this.i in this.tprm ){
    this.sprm = this.tprm[ this.i ].split("=");
    if( this.sprm[0] == "engine" ){
      this.engines.push(this.sprm[1]);
      if( this.sprm[1] == "wiki" )
        alert("Please noteWikipedia forces itself to be the only frame shown");
    }
    else
      this.params[ this.sprm[0] ] = this.sprm[1];
  }
}
//############################
//# function : engineBuild
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineBuild(){
  this.html = this.tmpl;
  this.frames = "<frameset rows="*";
  for(this.j=1;this.j<this.engines.length;this.j++)
    this.frames += ",*";
  this.frames += "" >";
  for( this.i in this.engines ){
    this.frames  += this.frame( this.engines[ this.i ], this.params[ "string"  ] );
  }
  this.frames += "</frameset>";
  this.html = this.html.replace("::FRAMES::", this.frames );
  //alert( "this.html:\n" + this.html );
  frameholder.document.open("text/html");
  frameholder.document.writeln( this.html );
  frameholder.document.close();
}
//############################
//# function : engineFrame
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineFrame(engine,query){
  this.url = "http://" + this.urls[engine] + query;
  this.tag = "<frame name="" + engine + "" src=""
    + this.url + "" />\n";
  return this.tag;
}
//############################
//# function : engineAddURL
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineAddURL( key, url ){
  this.urls[ key ] = url;
}
//############################
//# function : engineTMPL
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineTMPL( tmpl ){
  this.tmpl = tmpl;
}
//############################
//# function : engineClose
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################
function engineClose(){
}
//###### Initzialisers

//############################
//# function :
//# create date : 2004-05-20  10:03  :  ivar
//# last mod. : 2004-05-20  10:03 :  ivar
//############################

//######
  
  </script>
  <script language="JavaScript" type="text/javascript">
    function loader(){
    }
    function unloader(){
    }
  </script>
</head>
<body onload="loader()" onunload="unloader()">
    <table align="center" width="100%" height="100%"
       cellspacing="0" cellpadding="0" border="0" id="wrapper">
    <tr valign="middle"  height="100%">
      <td valign="middle" align="center">
        <table cellspacing="0" cellpadding="0" border="0" align="center" id="main">
        <form action="search.html" method="get" aonsubmit="return goSearch()" id="mainform">
        <tr>
        <td class="logo"><a href="http://www.electricray.org" target="_top"><img
          border =0 height=20 src="/images/eraylogorayonlytrans.png" /></a></td>
        <td id="title">Multiple Search Engine</td>
        <td align="right"><a href="http://www.electricray.org" target="_top"><img
          border =0 height=20 src="/images/eraylogorayonlytrans.png" /></a></td>
        </tr>
        <tr>
          <td colspan=3>
            Search for?
            <input type="text" name="string" value="" size=40 maxlength=120 class="box" />
          </td>
        </tr><tr>
          <td colspan=3>
            <table border=1 cellpadding=0 cellspacing=0 id="searches" align="center">
            <tr>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="google-web" checked />Google Web</li>
                  <li><input type="checkbox" name="engine" value="google-webuk" />Google Web UK</li>
                  <li><input type="checkbox" name="engine" value="google-news" />Google News</li>
                  <li><input type="checkbox" name="engine" value="google-groups" checked />Google Groups</li>
                </ul>
              </td>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="yahoo-web" checked />Yahoo Web</li>
                  <li><input type="checkbox" name="engine" value="yahoo-news" />Yahoo News</li>
                  <li><input type="checkbox" name="engine" value="alltheweb" checked />All The Web</li>
                  <li><input type="checkbox" name="engine" value="alltheweb-news" />All The Web News</li>
                </ul>
              </td>
        </tr><tr>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="msn" />MSN</li>
                  <li><input type="checkbox" name="engine" value="ask-jeeves" />Ask Jeeves</li>
                  <li><input type="checkbox" name="engine" value="lycos" />Lycos</li>
                  <li><input type="checkbox" name="engine" value="hotbot" />Hotbot</li>
                </ul>
              </td>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="wiki"  />Wikipedia</li>
                  <li><input type="checkbox" name="engine" value="thesaurus" />Thesaurus</li>
                  <li><input type="checkbox" name="engine" value="dictionary" />Dictionary</li>
                  <li><input type="checkbox" name="engine" value="" /></li>
                </ul>
              </td>
        </tr><tr>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="ebay" />eBay</li>
                  <li><input type="checkbox" name="engine" value="ebay-uk" />eBay UK</li>
                  <li><input type="checkbox" name="engine" value="amazon" />Amazon</li>
                  <li><input type="checkbox" name="engine" value="amazon-uk" />Amazon UK</li>
                </ul>
              </td>
              <td>
                <ul>
                  <li><input type="checkbox" name="engine" value="names" />Names</li>
                  <li><input type="checkbox" name="engine" value="whois" />Whois</li>
                  <li><input type="checkbox" name="engine" value="archive" />Archive</li>
                  <li><input type="checkbox" name="engine" value="" /></li>
                </ul>
              </td>
            </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td id="submit" colspan=3><input type="submit" value="Search ticked engines now" id="submit" /></td>
        </tr>
        </form>
       </table>
      </td>
    </tr>
    </table>
</body>
<!-- IEA 2K4 eray-->
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/tabsearch.zip">tabsearch.zip( 9 k)</a>


Search in different search engine

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Search multiple engines</title>
  <link rel="shortcut icon" href="/images/favicon.ico" />
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <meta name="keywords" content="search,google,yahoo,alltheweb,ivar,abrahamsen">
  <meta name="description" content="search enginer page">
  <script language="JavaScript" type="text/javascript" src="/js/eray_core2.js"></script>
  <script language="JavaScript" type="text/javascript">
    function loader(){
      //coreFunc.reloader( 4000 );
    }
    function unloader(){
      //coreFunc.unload();
    }
    function changeAction( form, what ){
      form.action = what;
    }
  </script>
  <!-- link href="/sites/todo/styles/error.css" rel="stylesheet" type="text/css" -->
  <style type="text/css">
  body{
    font-family: Sans,  Arial;
    background-color:  #0018a5;
    color: white;
    margin: 0px;
  }
  table.border{
    border: 6px outset   silver;
    background-color: black;    
    margin: 0px;
  }  
  .cell{
    text-align: center;
    white-space: nowrap;
    padding: 0px 3px;
  }
  .head{
    font-weight: 900;
  }
  .section{
    font-weight: 600;
  }
  .txt{
    font-weight: 100;
  }
  .title{  
    font-size: 11pt;    
  }
  .domain{  
    font-size: 9pt;
  }
  .desc{    
    font-size: 8pt;
  }
  </style>
</head>
<body onload="loader()" onunload="unloader()">
    <table align="center" width="100%" cellspacing="0" cellpadding="0" border="5" height="100%">
    <tr valign="middle"  height="100%">
      <td valign="middle" align="center">
        <table cellspacing="0" cellpadding="3" class="border" align="center">
        <tr>
        <td><a href="http://www.electricray.org" target="_top"><img 
          border =0 height=20 src="/images/eraylogorayonlytrans.png" /></a></td>
          <td awidth="100%" class="cell title head" colspan=1>            
            Search
          </td>
        <td align="right"><a href="http://www.electricray.org" target="_top"><img 
          border =0 height=20 src="/images/eraylogorayonlytrans.png" /></a></td>
        </tr>        
        <tr>
          <td colspan=3>
            <table border=1 cellpadding=0 cellspacing=0 width="100%">
            <form action="http://www.google.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Google
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" name="q"/><br />
                Web:<input type="radio" checked name="type" onclick="changeAction(this.form,"http://www.google.ru/search")" />
                Groups:<input type="radio" name="type"onclick="changeAction(this.form,"http://groups.google.ru/groups")"  />
                News:<input type="radio" name="type" onclick="changeAction(this.form,"http://news.google.ru/news")" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://search.yahoo.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Yahoo
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" name="p" /><br />
                Web:<input type="radio" checked name="type" onclick="changeAction(this.form,"http://www.google.ru/search")" />
                News:<input type="radio" name="type" onclick="changeAction(this.form,"http://news.search.yahoo.ru/search/news/")" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.alltheweb.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                All The Web
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" name="q" /><br />
                Web:<input type="radio" checked name="cat"value="web" />
                News:<input type="radio" name="cat" value="news" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://en.wikipedia.org/w/wiki.phtml" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Ask Jeeves
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" name="search" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                MSN
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://en.wikipedia.org/w/wiki.phtml" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Wikipedia
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" name="search" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Thesourus
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Dictionary
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                Amazon
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                eBay
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            <form action="http://www.thesourus.ru/search" method="get">
            <tr>
              <td class="cell domain section" colspan=1>
                eBay
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="text" />
              </td>
              <td class="cell desc txt" colspan=1>
                <input type="submit" value="Go" />
              </td>
            </tr>
            </form>
            </table>
          </td>
        </tr>
       </table>        
      </td>
    </tr>
    </table>    
</body>
<!-- IEA 2K3-->
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/tabsearch.zip">tabsearch.zip( 9 k)</a>