简体   繁体   中英

html input type button not working in Internet Explorer

trying to open an html file for a website. The following onclick is not working in Internet Explorer, but it works in google chrome, and firefox. Any suggestions?

<tr id=tr1>
  <td><input id=But1 style="background:url('butc.jpg')" value="Home" onclick="window.location.href='main.html'" type="button"></td>
  <td><input type="button" id=But1 style="background:url('buto.jpg')" value="Advertise with us" onclick="window.location.href='advertise.html'" ></td>
  <td><input id="But1" style="background:url('buto.jpg')" value="Become a marketer" onclick="window.location.href='market.html'" type="button"></td>
  <td><input id="But1" style="background:url('buto.jpg')" value="BudBuddies" onclick="window.location.href='buds.html'" type="button"></td>
  <td><input id="But1" style="background:url('buto.jpg')" value="BudTube" onclick="window.location.href='tube.html'" type="button"></td>
  <td><input id="But1" style="background:url('buto.jpg')" value="Laws" onclick="window.location.href='laws.html'" type="button"></td>
</tr>

i am two days into teaching myself html, and as far as why am i doing things the way im doing them well the truth is i have no idea what im doing at this point. what im trying to do is open an html file in the same window on a button click and this is working fine in firefox and chrome but when i open it in internet explorer 8 and 9 it does not work so any suggestion on what im doing wrong is appreciated. all the html file i am opening are local.

Any suggestions?

If you have a list of things, then use a list.

If you want a navigational control, then use a link.

See listamatic for examples of how to style lists of links to look like a row of buttons.

Having more than one input elements with the same Id can be the reason.

As a suggestion, use Markup Validation Service and see if there are any errors.

Markup Validation Service

This validator checks the markup validity of Web documents in HTML, XHTML, SMIL, MathML, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM