ทำ SEARCH ENGINE ของ GOOGLE,YAHOO,Altavista (Raging) ให้อยู่ในภายในอันเดียวกัน

เริ่มโดย wichan, 03 มกราคม 2009, 12:33:08

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

wichan

 :)ครับเริ่มเลยน้ะครับเพื่อเพิ่มความสะดวกใน web page ของเราครับ :)

นำ CODE ด้านล่างไปไว้ที่ <head> ครับ

<script language="JavaScript" type="text/javascript">
<!--
   var crawlername = new Array("Google","Yahoo","Altavista (Raging)");
   var crawleraction = new Array("http://www.google.com/search?q=","http://search.yahoo.com/bin/search?p=","http://www.altavista.com/sites/search/res_text?q=");
   
function populateCrawlers()
{
  var d=0,startcount=0,option;
  for (d=0;d<crawlername.length;d++)
{
      option = new Option(crawlername[d],crawleraction[d]);
  document.search.crawler.options[startcount] = option;
startcount++;
}
}

function initiateSearch(x)
{
      var url;
url = x.crawler.options[x.crawler.selectedIndex].value+x.q.value;
     self.location.href = url;
return (false);
}
//-->
</script>


ต้องการให้แสดง SEARCH ENGINE ที่ไหนก็นำ CODE ด้านล่างไปไว้ที่นั่นครับ <body> นะครับ

<form method="GET" name="search" onSubmit="return initiateSearch(this)">
<table summary="Search" width="50%" align="center">
<tr>
<th align="right"><font face="MS Sans Serif" size="1" color="#FF0000">SEARCH :</font></th>
<th align="left">
<font face="MS Sans Serif" size="1">
<input type="text" name="q" size="10" maxlength="100"><input type="submit" value="GO">
</font>
</th>
</tr>
<tr>
<th align="right"><font face="MS Sans Serif" size="1" color="#FF0000">โดยใช้
  SEARCH ENGINE ของ :</font></th>
<th align="left">
<font face="MS Sans Serif" size="1">
<Select name="crawler">
</Select>
</font>
</th>
</tr>
</table>
</form>


เพิ่ม onLoad="populateCrawlers()" เข้าไปใน <body> ครับ เป็นแบบด้านล่างนี้ครับ

<body onLoad="populateCrawlers()">

;)เท่านี้ครับ ;)เผื่อมีประโยชน์กลับเพื่อน ๆ ครับ