Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Clickable table cells.

Posted on 2010-08-28
7
Medium Priority
?
439 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 84

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 84

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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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 …

670 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