Click to See Complete Forum and Search --> : Reversing the text in Links


DistantSelf
11-30-2003, 12:58 PM
Does anyone know the script that reverses the links to read from right to left on hover? Thanks.

pyro
11-30-2003, 01:45 PM
Not sure why one would want to do that, but here you go:

<script type="text/javascript">
String.prototype.reverseText = function() {
return this.split('').reverse().join('');
}
onload = function () {
for (i=0; i<document.links.length; i++) {
document.links[i].onmouseover = function() {
this.firstChild.data = this.firstChild.data.reverseText();
}
document.links[i].onmouseout = function() {
this.firstChild.data = this.firstChild.data.reverseText();
}
}
}
</script>
</head>
<body>
<p><a href="http://www.w3.org/">W3C</a> | <a href="http://www.webdevfaqs.com/">Web Dev FAQs</a></p>

DistantSelf
11-30-2003, 01:54 PM
Thanks! :)

pyro
11-30-2003, 01:55 PM
You are welcome... :)