Yeah, but I would like to avoid using Javascript.
Main Topics
Browse All TopicsI have a button inside a link element, and the behavior in IE is confusing. The HTML looks something like this:
<a href="http://www.google.co
This works fine in FF, but not in IE. To complicate matters, it appears that the onClick event handler fires in both FF and IE, so something like this works:
<a href="http://www.google.co
Any idea what is happening here? I know I could take the button out and style the link via CSS, but I'm looking for alteratives.
Thanks!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Can you make a button image instead?
<a href="http://www.google.co
The <input type="button"> element wasn't meant to be used this way, but was meant as a way to create a generic button to which you could attach (via script) any behavior you want. I wouldn't expect to get a consistant behavior out of placing it inside of a hyperlink element. :-/
Of course, you can always make your hyperlink look a lot like a button via CSS, although this is generally approximate, and the actual accuracy of the buttonish appearance may vary with OS (especially between Windows and Mac).
If it needs to look like a regular HTML button, the form-and-hidden-fields method you and mvan01 described above is probably the best answer you're going to get (although method="link" is undefined, so it's probably just assuming the default value of method="get", which is what you should be using for this sort of case).
The answer to your question is - the button is always rendered by the browser IN FRONT of the link context (and all other contexts), so when you place your mouse over the button, the click event is sent to the button, and not to the link.
This is intentional for all form elements, so that when you use a drop-down box, the list always appears over the content and is not obscured by other elements. This is why sometimes you see badly rendered sites, where form elements such as buttons and text boxes appear over the top of other content.
When someone sees a button on a page, they expect to be able to click on it, and not have it obscured by some text or picture element, so it all makes sense.
Anyway, you have several options.
1) Use the onclick javascript handler. In which case you need to relax your rule about using javascript.
2) Wrap the button in a form. The example you tried earlier was using the method "link", if you want to use parameters, you need to use the method "get":
<FORM METHOD="GET" ACTION="page1.cgi?id=4">
<INPUT TYPE="submit" VALUE="Clickable Button">
</FORM>
3) Create an identical image of a button, with images for over and down states, and make the image a link.
4) CSS is the only way I know to place an active context over a form element, but you need to place the form elements inside a div with a lower z-index than a div that contains a link. Having said that, you need to fool the browser to re-position the higher div, and therefore the link context by using negative values, and I think this is now fixed in latest Firefox and IE6, so it's unlikely to be useful for you.
Try method (2) and let me know what happens
Business Accounts
Answer for Membership
by: knightEknightPosted on 2006-05-05 at 10:43:53ID: 16616891
You can achieve the same thing without the link by using javascript like this:
www.google .com/';" />
<input type="button" value="Update" class="actionBtn" onclick="location='http://