如何用一个按钮链接两个HTML页面?
答
这将添加一个按钮,并将其链接到登录页面:
<a href="path_to_login_page">
<button>Take me to the login page</button>
</a>
变化path_to_login_page
& Take me to the login page
自定义按钮。如果你已经有一个自定义按钮,并希望使用它:
<a href="path_to_login_page">
'Place your button here'
</a>
答
我个人只是改变了按钮,一个标准的定位。您仍然可以设置链接的样式,使其看起来像一个按钮。
<a href="index.html">Go home</a>
如果真元必须保持一个按钮,你可以这样做:
<button onclick="location.href='index.html'>Go home</button>
这不正是最好的做法,虽然。
答
这是最短,要做就做最快捷的方式:
<a href="login-page.html">
<button> Login Page</button>
</a>
运行,并在这里检查它:https://jsfiddle.net/2zov6q2v/14/