开发者

How can I get an html table cell that is a link to contain text and another link?

开发者 https://www.devze.com 2023-03-08 05:58 出处:网络
I\'m trying to get a table cell that is one big href to contain two things - an icon that opens a popup (at location A), and some text that follows the cell\'s href (to location B).However I can\'t qu

I'm trying to get a table cell that is one big href to contain two things - an icon that opens a popup (at location A), and some text that follows the cell's href (to location B). However I can't quite get it working.

Here's the HTML I have that only works for the icon/popup:

<table><tr><td>
  <a href="http://www.google.com>
    <span>
      <a onclick="window.open('http://www.yahoo.com', location=no,scrollbars=no,menubar=no,toolbar=no,status=no,resizable=yes')">
        <img src="smiley.png" />
      </a>
    </span>
    Go to Google
  </a>
</td></tr></table>

This works fine for clicking on the smiley icon and opening the yahoo popup, but clicking on "Go to Google" doesn't do anything.

Here's the HTML I have that works for following the href:

<table><tr><td>
  <a href="http://www.google.com>
    <img src="smiley.png" />
    Go to Google
  </a>
</td></tr></table>

This follows the href no matter what I click on in the cell (which makes sense, there's only one href).

I also tried this, but clicking on the icon would both open the popup and follow the href:

<tabl开发者_如何转开发e><tr><td>
  <a href="http://www.google.com>
    <img src="smiley.png" onclick="window.open('http://www.yahoo.com', location=no,scrollbars=no,menubar=no,toolbar=no,status=no,resizable=yes')"/>
    Go to Google
  </a>
</td></tr></table>

Any help?


You can't just have a link contain another link. Have two links, but separated. Use CSS to make them fill the cell if you have to.

0

精彩评论

暂无评论...
验证码 换一张
取 消