2017-03-05 81 views
1

我想使用JavaScript在多個網站上搜索相同的關鍵字。一次搜索多個網站的腳本

例如,在本網站上,當我在搜索欄中輸入「XXXX」時,我得到this result。在這種情況下,使用url來查找另一個關鍵字非常簡單。

this other website正在使用基於JavaScript的搜索引擎,當我搜索關鍵字時,url不會更改。 這個搜索欄使用的代碼看起來是這樣的:

<li class="lirecherche"> 
     <input name="rechercher" value="rechercher" onclick="this.value=''" /> 
    <a href="javascript:document.formchercher.submit();" style=" text-decoration: none;">OK</a></li> 

Is there a way to send a search request to this website from a script or an url ? (not a script that automatically type the keyword and press enter for me, but which is actually doing the research) 

編輯:

它指的這種形式。有這method="post"但它似乎並沒有出現在代碼中的任何其他地方。我怎麼能找到它要去的地方?

  <form name="formchercher" id="formchercher" method="post" action=""> 
    <table height="94" border="0" cellpadding="0" cellspacing="0" id="menuH"> 
     <tr> 
     <td width="37" valign="bottom" id="acc"><a href="index.php" onmouseover="MM_swapImage('bnav0','','images/env/nav/b_acc_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b_acc_on.jpg" name="bnav0" alt="retour accueil" width="51" height="85" border="0" /></a></td> 
     <td align="center" valign="bottom" class="b2"><a href="potageres_2.php" onclick="ouvre_menu(2,'rub')" onmouseover="MM_swapImage('bnav2','','images/env/nav/b2_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b2_off.jpg" name="bnav2" border="0" id="bnav2" /><br /> 
      Potagères</a></td> 
     <td align="center" valign="bottom" class="b3"><a href="fleurs_3.php" onclick="ouvre_menu(3,'rub')" onmouseover="MM_swapImage('bnav3','','images/env/nav/b3_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b3_off.jpg" name="bnav3" border="0" id="bnav3" /><br /> 
      Fleurs</a></td> 
     <td align="center" valign="bottom" class="b4"><a href="aromatiques_4.php" onclick="ouvre_menu(4,'rub')" onmouseover="MM_swapImage('bnav4','','images/env/nav/b4_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b4_off.jpg" name="bnav4" border="0" id="bnav4" /><br /> 
      Aromatiques</a></td> 
     <td align="center" valign="bottom" class="b5"><a href="cadeau_5.php" onclick="ouvre_menu(5,'rub')" onmouseover="MM_swapImage('bnav5','','images/env/nav/b5_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b5_off.jpg" name="bnav5" border="0" id="bnav5" /><br /> 
      Cadeau</a></td> 
     <td align="center" valign="bottom" class="b6"><a href="engrais-verts_6.php" onclick="ouvre_menu(6,'rub')" onmouseover="MM_swapImage('bnav6','','images/env/nav/b6_ov.jpg',1)" onmouseout="MM_swapImgRestore()"><img src="images/env/nav/b6_off.jpg" name="bnav6" border="0" id="bnav6" /><br /> 
      Engrais&nbsp;verts</a></td> 

回答

0

您需要找到存儲在「document.formchercher」中的表單,它幾乎肯定會是輸入字段的父級。它的行爲和方法應該在其開始的標籤中。

0

做更多的研究,我想通了,做什麼:

<form name="formchercher" id="formchercher" method="post" action=""> 

這種形式的任何行動。這意味着將提交到這個表單的index.php頁面。

我不得不填補完整的URL的行動,例如:

<form name="formchercher" id="formchercher" method="post" action="http://www.biaugerme.com/index.php"> 

這樣我可以從我自己的網頁上做了研究,並打開他們的網站上的結果。