PDA

View Full Version : noobie question: "Read more" script


tayf
07-05-2005, 04:10 AM
Hi folks,

On my website I want the news posts to show only say, 50 words and then have a "read more" link automatically put next to them. Then when the user clicks on the read more link it reveals the full text. I can do this with php but its a bit clunky compared to doing it with javascript.

I've scoured google but searching "read more javascript" in google isn't the most useful of things :P and I can't find anything useful.

I'm looking particularly for something xhtml compliant if possible.

Does anyone know of where I can find such a script?

Thanks for you reading.

SpirtOfGrandeur
07-05-2005, 01:43 PM
I do not know where to get the script but I will type it out for you and hopefully you can make it your self. :)


<span> First 50 words </span>
<span style='display:none;'> rest of the words</span>


You button would set the 2nd span's display property back to 'block' or 'inline' which ever you need. Then you could rehide it using 'none' again.