Forum Moderators: not2easy

Message Too Old, No Replies

Solve this ajax problem

Problem with show and hide data.

         

sys_engg

9:15 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



I have a link name "Show/hide". (As in Yahoo and Gmail)
I used Ajax/php/mysql/html for this problem.

Now i want, when i click on this link first time the data(in rows and column) displayed below the link from database.
When i click on this link second time the data should hide.

Little_G

9:54 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



Hi,

Um, ok, I don't know exactly what your trying to do but you can show and hide elements by changing their visibility attribute:


<div id="layer">Hello</div>
<a href="#" onclick="javascript:document.getElementById('layer').style.visibility='hidden';">Hide</a>

Andrew

supermanjnk

10:01 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



This is more of a javascript thing.

You will need something like this

<html>
<head>
<script type="text/javascript">
function toggle(id) {
var text = document.getElementById(id);
if (text.style.display!= 'block')
text.style.display = 'block';
else
text.style.display = 'none';
}
</script>
<style>
.text {
display:none;
}
</style>
</head>
<body>
<a href="#" onclick="javascript:toggle('1')">Show/Hide</a>
<div class="text" id="1">
test
</div>
</body>
</html>