2012-07-16 139 views
0

我不知道如何正确表达,所以在这里。HTML搜索栏

我在我的网页上创建了一个搜索栏,它使用您的输入文本来搜索另一个网站。 这是我有什么(东西都被删):

<form name="search" class="form-search" method="get" action="http://www.nameofwebsite.com/search.php?"> 
<input name="searchbynum" type="text" class="search-query input-large" onkeypress="return submitenter(this,event)"> 
<button type="submit" class="btn btn-primary">Search</button> 
</form> 

当实际的网站上进行搜索时,搜索网址如下:

http://www.nameofwebsite.com/search.php?searchbynum=search+phrase&searchbydesc=&Submit=Go 

去哪儿“搜索+短语”被什么是搜索。为了达到这一点,
在搜索结尾处添加“& searchbydesc = & Submit = Go”需要做些什么?

回答

1

将隐藏的字段添加到您的页面。

<form ...> 
    <div> 
     <input type="hidden" name="searchbydesc" value="" /> 
     <input type="hidden" name="Submit" value="Go" /> 
    </div> 
</form> 

请注意,您的HTML原样无效。 A <form>元素不能有<input />元素作为直系子元素,它们必须包装在<div><fieldset>或其他类似元素中。