2017-05-28 74 views
1

如何將此代碼鏈接到第2頁?我想將按鈕鏈接到另一頁

<div class="login"> 
<h1>Login</h1> 

<form method="post"> 

<input type="text" name="u" placeholder="Username" required="required" /> 
<input type="password" name="p" placeholder="Password" required="required" /> 
<button type="submit" class="btn btn-primary btn-block btn-large"></a>Let me in.</button> 
+4

爲什麼你有一個''你''元素裏面?無論如何,這是一個提交按鈕,所以你應該在你的'

'上放一個'action =「yourPage2.something'''屬性,然後點擊按鈕將輸入元素的值提交到你選擇的URL。 – nnnnnn

+0

https://developer.mozilla.org/en-US/docs/Learn/HTML/Forms –

回答

0

你不應該使用關閉標籤</a> 你能給形式執行一些動作。

<form action="somewhere.html"> 
<input type="text" name="u" placeholder="Username" required="required" /> 
<input type="password" name="p" placeholder="Password" required="required" /> 
<button type="submit" class="btn btn-primary btn-block btn-large">Let me in.</button> 
</form> 
0

如果你想使用的一個標籤就應該是這個樣子:

<a href="http://facebook.com"><button type='button'>lets get social</button></a> 

如果您希望新的鏈接在新標籤/窗口打開,你可以添加此成的一個標籤:target="_blank"

ie: <a href="http://facebook.com" target="_blank"> 
相關問題