2014-11-16 35 views
0

我想通過使用我的網站搜索欄來搜索網站上的電子小玩意(http://www.mudah.my/Malaysia/Electronics-for-sale-3000)。但我不知道如何將我的搜索欄與網站上的搜索欄相關聯,以獲得我想要的結果。如何使用我自己的搜索欄在特定網站上搜索項目?

<!DOCTYPE html> 

<html> 

<head><title>Seller Evaluation System</title></head> 

<body bgcolor="#66ffff"> 

<h1><center><font color="blue">Seller Evaluation System<center></h1> 

    <p><center> 
     <form action="http://www.mudah.my/Malaysia/Electronics-for-sale-3000"><input type="search" name="search" size="48" placeholder="Search Electronic Gadgets..."> 
     <input type="Submit" name="Search" value="Search"/>   
    </center></p> 
</br> 

</body> 

</html> 

回答

0

您將必須使用javascript。還有其他選項可供您動態更改。這樣

function searchSite(){ 
 
    var inputted=document.getElementById("searchinput").value; 
 
    var searchForm=document.getElementById("searchForm"); 
 
    searchForm.action="http://www.mudah.my/Malaysia/Electronics-3000/"+inputted+"-for-sale?lst=0&fs=1&q="+inputted+"y&cg=3000&w=3&so=1&st=s"; 
 
    searchForm.submit(); 
 
}
<form method="get" action="" id="searchForm"> 
 
    <input type="text" id="searchinput" > 
 
    <button onclick="searchSite()">Search</button> 
 
    </form>

+0

太感謝你了,我得到了答案,還有一個額外的事情,如果我想獲得搶我搜索的內容和表現出來我的網頁,也是用HTML完成的,還是JavaScript? – DanielTcH

+0

把javascript放在在Html中關閉body標籤之前或在你的之間的標籤標籤 – Billy

+0

如果我想抓取我搜索並顯示在我的網頁上的內容,是不是用HTML完成,還是JavaScript?或者也許有可能這樣做? – DanielTcH

0

東西,你可以用一個表格來做到這一點。只需用你喜歡的一個替換URL

<form action="https://www.davidodhiambo.com/store/search"> 
<input name="q"> 
<input type="Submit">