There are several different ways to do that -- first, simply put it inside a form that points to where you want it to go:
(有几种不同的方法可以做到这一点 - 首先,只需将其放在指向您希望的位置的表单中:)
<form action="/my/link/location" method="get">
<input type="submit" value="Go to my link location"
name="Submit" id="frm1_submit" />
</form>
This has the advantage of working even without javascript turned on.
(即使没有打开javascript,这也具有工作的优势。)
Second, use a stand-alone button with javascript:
(其次,使用带有javascript的独立按钮:)
<input type="submit" value="Go to my link location"
onclick="window.location='/my/link/location';" />
This however, will fail in browsers without JavaScript (Note: this is really bad practice -- you should be using event handlers, not inline code like this -- this is just the simplest way of illustrating the kind of thing I'm talking about.)
(然而,这在没有JavaScript的浏览器中会失败(注意:这是非常糟糕的做法 - 你应该使用事件处理程序,而不是像这样的内联代码 - 这只是说明我正在讨论的事情的最简单的方法。))
The third option is to style an actual link like a button:
(第三个选项是设置像按钮这样的实际链接:)
<style type="text/css">
.my_content_container a {
border-bottom: 1px solid #777777;
border-left: 1px solid #000000;
border-right: 1px solid #333333;
border-top: 1px solid #000000;
color: #000000;
display: block;
height: 2.5em;
padding: 0 1em;
width: 5em;
text-decoration: none;
}
// :hover and :active styles left as an exercise for the reader.
</style>
<div class="my_content_container">
<a href="/my/link/location/">Go to my link location</a>
</div>
This has the advantage of working everywhere and meaning what you most likely want it to mean.
(这样做的好处是可以在任何地方工作, 并且意味着您最想要的意思。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…