簡體   English   中英

html表單-提交搜索

[英]html form - submit search

我必須承認,我還不了解這一點。 我敢肯定,如果這樣做的話,那會很簡單。 我有一個Web模板,搜索不起作用。 這是代碼:

<form action="" method="post" id="search-form">
<fieldset>
<div><span>
<input type="text" value="Enter keyword here" onfocus="if(this.value=='Enter keyword here'){this.value=''}" onblur="if(this.value==''){this.value='Enter keyword here'}" />
</span><a href="#" onclick="document.getElementById('search-form').submit()"><img src="images/button.gif" alt="" /></a></div>
</fieldset>
</form>

這是行不通的。 我試圖插入到web.config文件中來解決“ 405”錯誤,但是現在出現“ 500”錯誤。 這是處理程序:

<handlers>
        <add name="*.html Page Requests" path="*.html" verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" preCondition="integratedMode" />
        <add name="*.htm Page Requests" path="*.htm" verb="*" type="System.Web.Handlers.TransferRequestHandler" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>

該表單代碼是否要求Java腳本並且未運行,請有人解釋。 謝謝。

只需遵循塞思的建議即可。 不要使用JavaScript提交表單。 除非您了解JavaScript,並且有使用JavaScript提交表單的特定原因(例如ajax),例如,

<form action="/somepath/someaction.do" method="post" id="search-form">

還要添加用於提交表單的HTML按鈕-請訪問http://www.w3schools.com/html/html_forms.asp上的 w3schools

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM