...

View Full Version : Help with showing/hiding text



ferret219
06-14-2007, 03:22 PM
I have created a news list using PHP, which displays the title of each news item on a page, but because there are other objects on the page, I would like to make the title clickable so that it will 'open' up and show the rest of the story. I have seen this on some websites before where the rest of the text on the page 'slides' down to make space for the text.

Thanks in advance,

Chris.

abduraooft
06-14-2007, 04:04 PM
I have created a news list using PHP, which displays the title of each news item on a page, but because there are other objects on the page, I would like to make the title clickable so that it will 'open' up and show the rest of the story. I have seen this on some websites before where the rest of the text on the page 'slides' down to make space for the text.

Thanks in advance,

Chris.

You may use seperate hidden <div>s to hold the details of each news (ofcourse you have to keep an id for them and should have some literal relation with its titles)

then make the title as a link, and on the onclick you can call a function with a dynamically generated value as parameter(use the counter variable of the loop) . In the definition of this function, you can toggle the display property of its underlying div between hidden and block

Eg: If the value passed on the onclick of first displayed title is say '1', just make


document.getElementById('detail_1').style.display='block'; if it was hidden else the reverse
where 'detail_1' is the id of div which is holding its details

hope this might help

regards,
art

ferret219
06-14-2007, 04:10 PM
Thanks for the quick reply, I'll give the code a try and post back with some feedback.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum