Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Hello!</title>
- </head>
- <body>
- <p id="truncateMe">New features were added and bugs were fixed since alpha1.
- Please help us to identify bugs by testing new features and looking for unintended
- backward compatability breaks, so we can fix the problems and fully document intended
- changes before PHP 5.4.0 is released.</p>
- <script type="text/javascript">
- var len = 100;
- var p = document.getElementById('truncateMe');
- if (p) {
- var trunc = p.innerHTML;
- if (trunc.length > len) {
- /* Truncate the content of the P, then go back to the end of the
- previous word to ensure that we don't truncate in the middle of
- a word */
- trunc = trunc.substring(0, len);
- trunc = trunc.replace(/\w+$/, '');
- /* Add an ellipses to the end and make it a link that expands
- the paragraph back to its original size */
- trunc += '<a href="#" ' +
- 'onclick="this.parentNode.innerHTML=' +
- 'unescape(\''+escape(p.innerHTML)+'\');return false;">' +
- 'read more<\/a>';
- p.innerHTML = trunc;
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment