Solved

Clickable table cells.

Posted on 2010-08-28
7
436 Views
Last Modified: 2012-05-10
Hello,

I have a 2x3 table as follows:

#E#
ECE

Where # is an image (of set size), E is an empty cell other than a background colour and C is the contents of the cell. What I want to do is make each cell clickable without using javascript, how can I do this or achieve a similar effect - if need be replacing the whole table with something completely different with the same effect?

Thanks,
Uni

Note: Will be AFK for a few hours.
0
Comment
Question by:Unimatrix_001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33551339
You can put a transparent GIF in the empty cells and make that the link.  Usually 'border="0"'.
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 33551357
Hm, I see what you mean, although what do you recommend I do for the contents cell. See the contents cell will most likely have text and I don't really want just the text to be hyperlinked but all the space surrounding the text also?

Thanks,
Uni
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 33551536
A javascript 'onclick' is the only way I know to make the whole <td> clickable.  You can't put an anchor around a <td>.  Demo code below.  The javascript method has two flaws.  #1 is that it is not recognized as a link because it's not an 'anchor' so your mouse cursor doesn't change.  #2 is that the method replaces the current window and 'back' doesn't work.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>Untitled</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" summary="">
<tr><td onclick="window.location.replace('http://www.w3schools.com');">dibsplace</td><a href="http://www.w3schools.com"><td>&nbsp;Noplace</td></a></tr>
</table>
</body>
</html>

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Unimatrix_001
ID: 33552749
Hi Dave,

Thanks for that - is there a way to perhaps replace the table completely with something that could work?

Uni
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 33553836
The only element that is a clickable link is an anchor, just a standard link like <a href="http://www.yourwebsite.com">abc</a>.  You can replace the 'abc' with an image to make an image clickable but I don't know what else you can put there.  If you make your boxes out of divs, you would have to use javascript like with the <td>s in my example.
0
 
LVL 3

Author Comment

by:Unimatrix_001
ID: 33554227
Hm, the limitations of HTML are REALLY showing up, how on earth did simple things like this never get into the standard early on is beyond me... Images it is then...

Thanks anyways,
Uni
0
 
LVL 3

Author Closing Comment

by:Unimatrix_001
ID: 33554230
:)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question