[thelist] link no wrap
Maximillian Schwanekamp
lists at neptunewebworks.com
Tue Oct 18 23:50:27 CDT 2005
Neal Watkins wrote:
> anybody have a way to make sure this links wraps - css
> or old html (anything)
> http://sipphone.com/badhtml/
If you're using a template engine or something similar for the
presentation layer, you could filter for all links with a length > X
chars. I use Smarty, which has a nice filter for this available. I'm
guessing that you're not using something like that, so maybe some client
side scripting would help. Something like this (excuse my rough
javascript, I'm still a clientside DOM noob):
window.onload = function(){
if(! document.getElementsByTagName ){ return; }
var thelinks = document.getElementsByTagName('a');
for(i=0;i<thelinks.length;i++){
if(thelinks[i].childNodes.length>0
&& thelinks[i].childNodes[0].nodeValue
&& thelinks[i].childNodes[0].nodeValue.length > 80){
thelinks[i].childNodes[0].nodeValue =
thelinks[i].childNodes[0].nodeValue.substr(0,77)+'...';
}
}
Briefly tested on IE6/Win and FF1/Win... Maybe you can improve on this
suggestion. Of course it won't help for those who have CSS on but JS
off, but hey nobody's perfect!
--
Max Schwanekamp
http://www.neptunewebworks.com/
More information about the thelist
mailing list