467,886 Members | 1,799 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,886 developers. It's quick & easy.

URL link using Button not working in IE

I would like to use a Form "button" (or "input", either one) within an
anchor, instead of using text or creating a graphic. This works fine
in all browsers but IE, but IE, while showing the correct URL in the
status line and the tooltip, DOESN'T initiate the link.

The code is essentially:

<a href="http://foo.com/whatever.htm">
<input type="button" value="Click Me"></a>

Works fine in Mozilla, Opera, etc., but not in IE. Any ideas?

Don

Jul 24 '05 #1
  • viewed: 21997
Share:
7 Replies


ra***@alum.mit.edu wrote:

I would like to use a Form "button" (or "input", either one) within an
anchor, instead of using text or creating a graphic. The code is essentially:

<a href="http://foo.com/whatever.htm">
<input type="button" value="Click Me"></a>


<form action="http://foo.com/whatever.htm">
<input type="submit" value="Click Me">
</form>

Thor

--
http://www.anta.net/OH2GDF
Jul 24 '05 #2
<input type="button"
onclick="window.location='http://www.google.com/'">

break frames
<input type="button"
onclick="top.window.location='http://www.google.com/'">

new window
<input type="button" onclick="window.open('http://www.google.com/')">

Jul 24 '05 #3
doing it that way will put a "?" on the end of the url when you arrive
at the page. best to use the javascript way to avoid it.

<input type="button" onclick="window.location='http://www.google.com/'">

Jul 24 '05 #4
in comp.infosystems.www.authoring.html, dw************@gmail.com wrote:
doing it that way will put a "?" on the end of the url when you arrive
at the page. best to use the javascript way to avoid it.
What exactly does it hurt?
<input type="button" onclick="window.location='http://www.google.com/'">


And if user has JS disabled?
This

<form action="http://example.com/">
<input type="submit" value="Click Me"
onclick="window.location='http://example.com/';return false;">
</form>

is only little better. You need to check if windows.location is allowed.
I don't know how.

Anyway, making link look like button is stupid:
http://www.cs.tut.fi/~jkorpela/www/links.html#forms
--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Utrecht, NL.
Support me, buy Opera:
https://secure.bmtmicro.com/opera/bu...tml?AID=882173
Jul 24 '05 #5
On 8 Jun 2005 15:02:58 -0700, dw************@gmail.com wrote:
doing it that way will put a "?" on the end of the url
So what?
when you arrive at the page.
Where you eventually arrive depends on what the server wants to do.
best to use the javascript way to avoid it.


Wrong.
Jul 24 '05 #6

<ra***@alum.mit.edu> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I would like to use a Form "button" (or "input", either one) within an
anchor, instead of using text or creating a graphic. This works fine
in all browsers but IE, but IE, while showing the correct URL in the
status line and the tooltip, DOESN'T initiate the link.

The code is essentially:

<a href="http://foo.com/whatever.htm">
<input type="button" value="Click Me"></a>

Works fine in Mozilla, Opera, etc., but not in IE. Any ideas?

Don


In answering the actual question you put, rather than questions you didn't
put, my suggestion is this:

Briefly, in the IE event model, events bubble upwards through the document
hierarchy. They are first received by the element upon which the event
occurred. If not handled, they bubble up through the hierarchy until they
are. There are ways to modify this behaviour.
In your code, the button is at the bottom of this branch of the hierarchy.
It recieves the click event, and being a button, handles it. The event does
not proceed up the chain to the anchor element; the link is not activated. A
button handles click events automatically, though, until an event-handler is
explicitly provided to it, does nothing with it.

NOW it is appropriate to ask why you are bothering to do it this way. As the
other posts suggest, use a button or a link. There is no need for both.
HTML-only solutions avoid the pitfalls of disabled script in client.

Laurence
Jul 24 '05 #7
Lauri Raittila wrote:
[Somebody wrote:]

a "?" on the end of the url


What exactly does it hurt?


Tacking a lone '?' to the end of a path creates a new URI
which by STD66 isn't equivalent to the '?'-less one, though
it could still be equivalent in the sense that it identifies
the same resource.

So, for one, there's (potential) caching implications here,
because the controller now has two addresses published that
point to the same location.

Cheers,

--
Jock

Jul 24 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.