是的,那絕對沒問題。但你需要有兩個用戶名字段,例如:
<form action="login.jsp">
<input type="text" name="username">
<input type="password" name="password">
<input type="submit">
<input type="reset">
</form>
<form action="search.jsp">
<input type="text" name="username">
<input type="submit">
<input type="reset">
</form>
...但這不應該是你的UI設計方面的問題。
如果你想使用一個用戶名場,你可以使用單一形式,改變action
取決於其提交按鈕使用JavaScript壓:
<form>
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Login" onclick="this.form.action = 'login.jsp'">
<input type="submit" value="Search" onclick="this.form.action = 'search.jsp'">
<input type="reset">
</form>
...但這要求用戶啓用JavaScript。絕大多數人都這樣做,但仍值得注意。
當然,你可以做到這一點。你爲什麼不嘗試呢?這不是說你的機器會崩潰或燒壞......或者它是? –