Web Hosting, Design, & Coding forum

Question

Button link works in Chrome and Firefox, not IE

by matthiashess / March 13, 2012 4:21 AM PDT
Answer This Ask For Clarification
Discussion is locked
You are posting a reply to: Button link works in Chrome and Firefox, not IE
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Button link works in Chrome and Firefox, not IE
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
Answer
Is that IE prior to IE9?
by MarkFlax Forum moderator / March 13, 2012 4:29 AM PDT

If so, have a look at http://www.w3schools.com/tags/tag_button.asp and their "Tips and Notes".

It seems that in IE prior to IE9 you need to use text between the button tags, whereas IE 9 and other browsers submits the content of the value attribute, eg an image.

Mark

Collapse -
Unsure about the meaning of "submit"
by matthiashess / March 13, 2012 5:18 AM PDT

Yes thanks, it's IE8. Since I'm not using the button in a form, I'm a bit unclear about the note "If you use the <button> element in an HTML form, different browsers may submit different values." It's not supposed to submit any data. The image appears properly in each browser; it's just the <a> tag that doesn't seem to be working.

I'll see if I can find a machine with IE9 to try it on.

Collapse -
Submit
by MarkFlax Forum moderator / March 13, 2012 5:50 AM PDT

Yep I am not an expert and I am not confident about his use of the word Submit, but I assume it means a click 'submits' an instruction to be followed, like a javascript on_click event.

{LOL, I had to separate on and click and the forum software would not allow me to use the two words together. Security reasons I imagine.}

So when you click the button in Firefox, Chrome, etc, it submits the click to take the user to the Google home page. But in IE8 and below that fails as IE8<= expects text in place of the image.

If you replace the button tag with Form and Input, it should be OK.

There are ways to use HTML to identify which browser and which version of that browser the user is using, and you might need that if you are publishing this web page, because many IE users are still using IE8 and below as XP and below does not accept IE9.

Mark

Collapse -
Guess I'm back to using a plain image
by matthiashess / March 14, 2012 1:48 AM PDT
In reply to: Submit

I tried using <input> but it doesn't allow me to use an image on the button. I also tried using <button> with window.open but javascript doesn't work well with the database-driven site.

I thought this would be much simpler--I guess I'll just go back to putting the image inside <a> tags and give up on the fancy clicking action of a 3D button. A pity as my original button worked perfectly in browsers except IE8, including mobile browsers!

Collapse -
I understand the difficulties.
by MarkFlax Forum moderator / March 14, 2012 5:06 AM PDT

But if you can find out how to check which browser (and version) is being used, you can still do this. then you can add code for the IE8 and below browsers whilst IE9 users and other browser type users would see the buttons as you designed them.

Not easy as you would probably need to do the recognition in Javascript, but it can be done.

Mark

Collapse -
Answer
I would probably
by Sovereign Forum moderator / March 17, 2012 2:14 PM PDT

omit the button all together and just link the image. If you need something that looks like a button, you can just style the link to emulate one.

~Sovereign

Collapse -
Answer
Use JS
by xweque / June 14, 2012 10:55 PM PDT

If you want to be sure it works in all browsers and not get bugged, just set a <input type="button" value="Visit my website!" onClick="window.loaction = 'http://www.yourwebsite.com/index.html'">

Popular Forums
icon
Computer Help 47,885 discussions
icon
Computer Newbies 10,322 discussions
icon
iPhones, iPods, & iPads 3,188 discussions
icon
Security 30,333 discussions
icon
TVs & Home Theaters 20,177 discussions
icon
HDTV Picture Setting 1,932 discussions
icon
Phones 15,713 discussions
icon
Windows 7 6,210 discussions
icon
Networking & Wireless 14,510 discussions

CNET Forums

Looking for tech help?

Whether you’re looking for dependable tech advice or offering helpful tricks, join the conversation in our forums.