Jason a écrit :
I have a piece of text that could have http://somelink.com in it. I
want to convert every potential hyperlink to an actual link in HTML,
like <a href='$link'>$link</a>
What is the best way to do this in Javascript?
Don't know what is the best ... you could try :
onload = function() {
var L = document.links;
// or
// L = document.getElementsByTagName('A');
for(var i=0; i<L.length; i++)
{
L[i].href = 'http://somelink.com';
if(L[i].text) { L[i].text = 'my link'; }
else L[i].innerHTML = 'my link';
}
}
--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date