锚定输入按钮周围的链接 [英] Anchor link around input button

查看:94
本文介绍了锚定输入按钮周围的链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我知道有两种方法可以在HTML页面上放置链接; (1)使用

锚元素,(2)使用javascript响应事件(例如

onclick)并设置位置。


我最近开始使用锚点更多,我最终碰巧

尝试在输入按钮周围放置一个锚点链接,如你所见:

< a href =" example.com">< input type =" button"值= QUOT;实施例" />< / a>


这在Firefox和Chrome中运行良好,但它在IE中没有任何影响

(你可以按下按钮,但没有任何反应)。为什么这样,我怎么能修复它?我应该坚持使用javascript方法,如下所示:


< input type =" button"值= QUOT;实施例" onclick =" location.href =

''example.com'';" />


谢谢。

Hey, I know of two ways to place a link on an HTML page; (1) use the
anchor element, and (2) use javascript to respond to an event (such as
onclick) and set the location.

I recently started using anchors more, and I eventually happened to
try to put an anchor link around an input button, as you can see:

<a href="example.com"><input type="button" value="Example" /></a>

This worked fine in Firefox and Chrome, but it doesn''t have any effect
in IE (you can push the button, but nothing happens). Why is this, how
can I fix it, and should I just stick with the javascript method as
shown below:

<input type="button" value="Example" onclick="location.href =
''example.com'';" />

Thanks.

推荐答案

" bgold12" < bg ***** @ gmail.comwrote in message

news:3e ************************* ********* @ b31g2000 prb.googlegroups.com ...
"bgold12" <bg*****@gmail.comwrote in message
news:3e**********************************@b31g2000 prb.googlegroups.com...

嘿,我知道有两种方法可以在HTML页面上放置链接; (1)使用

锚元素,(2)使用javascript响应事件(例如

onclick)并设置位置。


我最近开始使用锚点更多,我最终碰巧

尝试在输入按钮周围放置一个锚点链接,如你所见:

< a href =" example.com">< input type =" button"值= QUOT;实施例" />< / a>


这在Firefox和Chrome中运行良好,但它在IE中没有任何影响

(你可以按下按钮,但没有任何反应)。为什么这样,我怎么能修复它?我应该坚持使用javascript方法,如下所示:


< input type =" button"值= QUOT;实施例" onclick =" location.href =

''example.com'';" />
Hey, I know of two ways to place a link on an HTML page; (1) use the
anchor element, and (2) use javascript to respond to an event (such as
onclick) and set the location.

I recently started using anchors more, and I eventually happened to
try to put an anchor link around an input button, as you can see:

<a href="example.com"><input type="button" value="Example" /></a>

This worked fine in Firefox and Chrome, but it doesn''t have any effect
in IE (you can push the button, but nothing happens). Why is this, how
can I fix it, and should I just stick with the javascript method as
shown below:

<input type="button" value="Example" onclick="location.href =
''example.com'';" />



为什么要将按钮变成链接?如果你只是想要你的链接

看起来像纽扣,那你为什么不用那种方式来设计呢?

Why do you want to turn buttons into links? If you just want your links to
look like buttons, then why don''t you style them that way?


2008年11月3日星期一19:48:43 -0800(太平洋标准时间),bgold12< bg ***** @ gmail.com>

写道:
On Mon, 3 Nov 2008 19:48:43 -0800 (PST), bgold12 <bg*****@gmail.com>
wrote:

>嘿,我知道有两种方法可以在HTML页面上放置链接; (1)使用
锚元素,(2)使用javascript来响应事件(如
onclick)并设置位置。

我最近开始使用锚点更多,我最终碰巧尝试在输入按钮周围放置一个锚点,如你所见:

< a href =" example.com">< input type =" button"值= QUOT;实施例" />< / a>

这在Firefox和Chrome中运行良好,但它在IE中没有任何影响(你可以按下按钮,但没有任何反应) 。为什么这样,我可以如何解决它,我应该坚持使用如下所示的javascript方法:

< input type =" button"值= QUOT;实施例" onclick =" location.href =
''example.com'';" />

谢谢。
>Hey, I know of two ways to place a link on an HTML page; (1) use the
anchor element, and (2) use javascript to respond to an event (such as
onclick) and set the location.

I recently started using anchors more, and I eventually happened to
try to put an anchor link around an input button, as you can see:

<a href="example.com"><input type="button" value="Example" /></a>

This worked fine in Firefox and Chrome, but it doesn''t have any effect
in IE (you can push the button, but nothing happens). Why is this, how
can I fix it, and should I just stick with the javascript method as
shown below:

<input type="button" value="Example" onclick="location.href =
''example.com'';" />

Thanks.



如果正确完成,标准按钮就是一个链接。如果JS

关闭,那将无法工作。

如果您想按照自己的方式进行操作,请创建一个看起来像按钮的图像

然后使用锚点。关闭或打开JS。

A standard button is a link if done correctly. Which won''t work if JS
is off.
If ya want to do it your way, create an image that looks like a button
and then use anchors. Works with JS off or on.


richard写道:
richard wrote:

标准按钮是链接如果正确完成。如果JS

关闭,哪个不行。
A standard button is a link if done correctly. Which won''t work if JS
is off.



但是,除非我错过了一些技巧,否则生成的URL将至少为
至少是一个尾随的?。这可能是浏览器特定的,但我不这么认为。


-

Steve Swift
http://www.swiftys.org.uk/swifty.html
< a rel =nofollowhref =http://www.ringers.org.uktarget =_ blank> http://www.ringers.org.uk


这篇关于锚定输入按钮周围的链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆