0

(If you are familiar with Memcached, better) can take a look at the img.

on the third column (named 'Value'), I need to put a 'button/link' that when clicked it will display/hide the content of the cell. In a sort of javascript 'toggle' function. (i'm not sure which to use: found a nice mootools styling here but i'm stuck on how to use it in this script.

Can you help me modify this table, for the third column to display the result when a button in this cell is clicked (and then click again and hide it)?

Here is the snippet for the table:

$a = getMemcacheKeys();

echo "<table class='prettytable'><tr><th>Key</th><th>Date Set</th><th>Value</th></tr>";

foreach ($a as $key => $v)
{
	if (count($v) == 3)
	echo "<tr><td>{$key}</td><td>" . date('r',$v[1]) . "</td><td class='button'><pre>" . print_r($v[3],1) . "</pre></td></tr>\n";
}

echo "</table>";

thanks

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by phoenix_2000
2

To toggle something use jQuery and .toggle()
http://api.jquery.com/toggle/

This will toggle display:none;

Edit something like this...

<script type="text/javascript">
$('#clickme').click(function() {
  $('#cell').toggle('slow');
});
</script>

Edited by Danny159: n/a

Votes + Comments
thanks indeed :)
0

It's not really necesary to use jquery for that even, document.getElementById().style.display does it all.

Remember, PHP is a server side language: you can't do anything with it AFTER the user has the page on his screen, unless you want to use AJAX.
But to be honest, that sounds a little to complex for a small script like this

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.