href a table row

M

M.Siler

How do I make a the full row a hyperlink? I've tried putting the <a></a>
around the <tr></tr> tag but that doesn't work.

<tr bgcolor="#EBD5B3" onMouseOver="javascript:style.background='#FBE5C3'"
onMouseOut="javascript:style.background='#EBD5B3'">
<td width="20">&nbsp;</td>
<td width="23">&nbsp;</td>
<td width="4">&nbsp;</td>
<td width="350"><font face="Tahoma" size="2">
<a onmouseover="title="External Link will open in a new Window"
target="_blank" href="http://www.countyhistory.com/grant/start.html">Grant
County</a></font></td>
<td width="10">&nbsp;</td>
</tr>
 
P

p c

Create hyperlinks to the same href for the content of each cell in that
row (skip empty cells with only space characters).
...PC
 
M

M.Siler

Not exactly what I was looking for... let me explain further;

[ CNN ]
[ Fox News ]
[ MSNBC ]

If the above lines represent rows, the href only make the text the link, not
the blank area of the cells to the right of the text. The onMouseOver &
onMouseOut make the whole row appears it's selected but click in the area to
the right of the text does not take the user anywhere. How can I make the
whole row or at least the entire cell a hyperlink so that if I was to click
where the X is in the example cell below that the user would be taken to
www.cnn.com?

[ CNN X ]
 
N

Nicholas Savalas - http://savalas.tv

Here is a simple example, and includes the mouseover color change your
code asks for too. Tell me if it works for you:

<html>
<head>
<title>How do I make a the full row a hyperlink?</title>
<script type="text/javascript">
function MyTDColor(tableRow, highLight)
{
if (highLight)
{
tableRow.style.backgroundColor = 'yellow';
}
else
{
tableRow.style.backgroundColor = 'white';
}
}
function TDNav(TDUrl)
{
document.location.href = TDUrl;
}
</script>
</head>
<body>
<table width="90%" border="1">
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page1.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page2.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page3.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
</table>
</body>

Good luck, M.Siler.
 
T

Thomas A. Rowe

I think most user would know to click on the words, if they appear to be hyperlinks, and not the
blank areas around the text.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
M

Murray

Assign a display:block style to the anchor tags in each cell. They will
then fill the cell completely and accompish what you want!

--
Murray
M.Siler said:
Not exactly what I was looking for... let me explain further;

[ CNN ]
[ Fox News ]
[ MSNBC ]

If the above lines represent rows, the href only make the text the link,
not the blank area of the cells to the right of the text. The onMouseOver
& onMouseOut make the whole row appears it's selected but click in the
area to the right of the text does not take the user anywhere. How can I
make the whole row or at least the entire cell a hyperlink so that if I
was to click where the X is in the example cell below that the user would
be taken to www.cnn.com?

[ CNN X ]

p c said:
Create hyperlinks to the same href for the content of each cell in that
row (skip empty cells with only space characters).
..PC
 
M

M.Siler

That worked. I added a little code so the cursor changes to the hand and
also the status bar updates with a message. But I can't figure out how in
the JavaScript function to make the popup title to be displayed. The one
where in the TR tag you'd put title="message goes here"

<html>
<head>
<title>How do I make a the full row a hyperlink?</title>
<script type="text/javascript">
function MyTDColor(tableRow, highLight)
{
if (highLight)
{
tableRow.style.backgroundColor = 'yellow';
tableRow.style.cursor='pointer';
window.status='External Link';
}
else
{
tableRow.style.backgroundColor = 'white';
window.status='';
}
}
function TDNav(TDUrl)
{
document.location.href = TDUrl;
}
</script>
</head>
<body>
<table width="90%" border="1">
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page1.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page2.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
<tr onmouseover="MyTDColor(this, true);"
onmouseout="MyTDColor(this, false);"
onclick="TDNav('page3.htm');">
<td>bla</td>
<td>bla</td>
<td>bla</td>
</tr>
</table>
</body>
 
M

M.Siler

If people with to turn off js that's their choice. But I don't think they'd
be missing much because they'd be too busy watching for black helicopters.
I'm not saying there aren't risk with js code, but there are risk with
everything in live. One has to decide for themselves which ones they are
willing to accept.
 
S

Steve Easton

10 per cent of browsers have JavaScript disabled.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
M

Murray

A simple display:block works with javascript on or off, and does exactly the
same thing.
 
M

M.Siler

Then 90% will have no problem.

Steve Easton said:
10 per cent of browsers have JavaScript disabled.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
.......................with a computer
 
T

Thomas A. Rowe

However, that 10% could be the ones with the money to purchase your products or services, etc. if
your site is commercial... so do you really want to not be able to serve them?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
T

Thomas A. Rowe

I agree with you 100%. I just pointing out the 10% could be money in the bank...

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
M

Murray

Definitely.

--
Murray
============

Thomas A. Rowe said:
I agree with you 100%. I just pointing out the 10% could be money in the
bank...

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
==============================================
If you feel your current issue is a results of installing
a Service Pack or security update, please contact
Microsoft Product Support Services:
http://support.microsoft.com
If the problem can be shown to have been caused by a
security update, then there is usually no charge for the call.
==============================================
 
P

P@tty Ayers

Murray said:
Why do it at all when there is a simpler, and more functional alternative?

Maybe because he's not sure how to add the CSS, and doesn't want to ask.
:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top