Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wordwrap long links in tables - how? 2

Status
Not open for further replies.

leegold2

Technical User
Oct 10, 2004
116
I find if I have have a long hyperlink in a table cell ( ie. in a <td> ) it will not wordwrap - it's considered a long word by html I guess. They can be pretty long and this forces all my table cells on a col. to be as long as the longest link.

Are there any tricks to make links wrap at a certain point? I'd even consider hard coding something into the link itself if necessary?

Thanks
 
Yes, with Javascript or some other language.

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
yeah, you could do something like this:
Code:
<script>
function chopLinks()
{
maxLength = 20; //the cutoff point
linkText = '';
for (x=0;x<document.links.length;x++)
{
linkText = document.links[x].innerHTML;
if (linkText.length > maxLength) 
{
document.links[x].innerHTML = linkText.slice(0,(linkText.length/2))+"<BR>"+linkText.slice((linkText.length/2),linkText.length);
}
}
}
</script>

hope that helps

"Insane people are always sure that they are fine. It is only the sane people who are willing to admit that they are crazy." - Nora Ephron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top