You are here: Re: how to highlight cell « PHP SQL « IT news, forums, messages
Re: how to highlight cell

Posted by Steve on 10/18/06 16:09

| Both solutions require you to put code at each cell though...
| I've never figured out any way around it.
|
| Ex:
| <?
| $cellStyles = array();
| $cellStyles[1][0] = 'style="background-color:#CCCCCC;"';
| ?>
|
| <table>
| <tr>
| <td <?=$cellStyles[0][0]?>>a</td>
| <td <?=$cellStyles[1][0]?>>b</td>
| </tr>
| <tr>
| <td <?=$cellStyles[0][1]?>>c</td>
| <td <?=$cellStyles[1][1]?>>d</td>
| </tr>
| </table>


perhaps this may be easier (if i understood you correctly):


<html>
<style type="text/css">
td
{
background-color : white;
cursor : pointer;
width : 50px;
}
</style>
<script type="text/javascript">
var currentCell;
function colorMe(el)
{
if (!el){ return; }
if (!el.style){ return; }
if (currentCell){ currentCell.style.backgroundColor = ''; }
currentCell = el;
currentCell.style.backgroundColor = '#CCCCCC';
}
</script>
<body>
<table>
<tr>
<td onclick="colorMe(this);">a</td>
<td onclick="colorMe(this);">b</td>
</tr>
<tr>
<td onclick="colorMe(this);">c</td>
<td onclick="colorMe(this);">d</td>
</tr>
</table>
<body>
<html>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация