Mega Code Archive

 
Categories / JavaScript DHTML / Ajax Layer
 

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>                     tabsearch.zip( 9 k)