View Full Version : td onclick
The Wizzard
04-30-2003, 06:30 AM
how do you make a cell clickable? I want to make it open up a page.
cg9com
04-30-2003, 06:52 AM
It can be done like this:
onclick="location.href='url'"
onclick is a javascript event handler.
The Wizzard
04-30-2003, 07:18 AM
im trying to use it to open a popup window, im using this... its not working...
<td onclick="location.href='javascript:MM_openBrWindow('enlarge.asp?vid=8','enlargeimage','scrollbars=no,resizabl e=no,width=640,height=520')" alt="View an Enlarged Picture of this car!"'" style="cursor:hand">
reidadam
04-30-2003, 02:04 PM
Are you having problems in all the browsers?
Roy Sinclair
04-30-2003, 05:01 PM
Originally posted by The Wizzard
im trying to use it to open a popup window, im using this... its not working...
<td onclick="location.href='javascript:MM_openBrWindow('enlarge.asp?vid=8','enlargeimage','scrollbars=no,resizabl e=no,width=640,height=520')" alt="View an Enlarged Picture of this car!"'" style="cursor:hand">
Of course it's not working, opening a popup isn't the same as changing the URL for the current page. You can just remove the "location.href='javascript:" part and it should work but why are you doing it that way instead of just using the proper tag in the proper way?
<td><a href="enlarge.asp?vid=8" onclick="MM_openBrWindow('enlarge.asp?vid=8','enlargeimage','scrollbars=no,resizable=no,width=640,height=520' );return false;">---replace this with your table cell content---</a></td>
The "alt" property should be on the image tag for the small image and it should be "title" not "alt", "alt" is for describing the image when the image is unavailable and "title" is for use for the little popup. Using the tag the way I just showed makes it possible for someone who has javascript disabled to still see the larger image (via the main window instead of a popup) while also still perserving the popup for those with javascript enabled and it also makes the page's content more accessible for someone who's disabled.
Arctic Fox
05-02-2003, 03:13 AM
Maybe try:
<td>
<a href="javascript:;" onclick="location.href='java script:MM_openBrWindow('enlarge.asp?
vid=8','enlargeimage','scrollbars=no,resizable=no,width=640,height=520')" alt="View an Enlarged Picture of this car!"'" style="cursor:hand; width:100%;">Linking text</a>
</td>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.