Jump to content

links in tables opening in _self and _blank!


niccio

Recommended Posts

Kind of pulling my hair out over this one. I have a table on my site and the cells and text in the cells link to different places. The problem is that the hyperlinks open in the same window and in a new window! I'm guessing it's some small issue with the coding, but I'm going crosseyed figuring it out!

<TABLE CLASS="Table1"><TR> <TD onclick="window.location.href='//kahspkfs01/bco/Accordian/Structure/Link_arb_forums/index.htm/'" target="_blank"><a class="c1" href="//kahspkfs01/bco/Accordian/Structure/Link_arb_forums/index.htm/" target="_blank">Arbitration Forums</a></TD> </TR><TR> <TD onclick="window.location.href='https://www.cporderpoint.com/orderpoint/'" target="_blank"><a class="c1" href="https://www.cporderpoint.com/orderpoint/" target="_blank">Choicepoint</a></TD> </TR><TR> <TD onclick="window.location.href='https://www.armsweb.com/armslogon/'" target="_blank"><a class="c1" href="https://www.armsweb.com/armslogon/" target="_blank">ARMS</a></TD>   </TR></TABLE>

p.s. anyone know why clicking on "insert: Center, Insert: CODEBOX, etc." on the side of my screen doesn't work in this forum? Is it an IE8 issue?

Link to comment
Share on other sites

The onclick handler in each <TD> element causes the new location to open in the current window. A <TD> element cannot have a target attribute, so that is ignored. The target attribute in your <a> element causes the link to open in the new window, since clicking on the link also registers as a click on the cell.There is no reason at all to have that onclick handler in your <td> elements. You're doing the work twice. Unless you have some goal I can't figure out, clicking on the text link should be enough.

Link to comment
Share on other sites

The only issue I'm running into with clicking on the text is that the cursor has to be exactly positioned on the text (which for some reason is difficult for the employees). The result I was going for is to be able to click anywhere in the cell and open the link in a new window.

Link to comment
Share on other sites

The solution is for each link to fill the entire table cell. Add this CSS to the definitions for the <a> elements in your table:width: 100%;height: 100%;display: inline-block;

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...