Scripts: Javascript

Create a Link From a Table Cell <TD>

This script shows that you can apply a link to a table cell using the onClick event.

Yahoo!
Yahoo! (in a window)

(Note: I have applied the "cursor: pointer" style to each cell as well to give the impression of a conventional link)

<SCRIPT LANGUAGE="JavaScript">
<!--
function linkCell(URL) {
window.location.href = URL
}
function linkCellWin(URL) {
window.open(URL,'newWin','toolbar=no,location=no,status=no,menubar=no, scrollbars=auto,resizable=yes,width=300,height=200');
}
//-->
</SCRIPT>>

<TABLE WIDTH="300" BORDER="1" BORDERCOLOR="#FFFFFF" ALIGN="center">
<TR>
<TD ALIGN="CENTER" STYLE="cursor: pointer" onClick="linkCell('http://uk.yahoo.com/')">Yahoo!</TD>
</TR>
<TD ALIGN="CENTER" STYLE="cursor: pointer" onClick="linkCellWin('http://uk.yahoo.com/')">Yahoo! (in a window)</TD>
</TR>
</TABLE>