Discussion Locked

Javascript Help

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello Everyone and great day to all! I am an intermediate web developer and want to know how to create links that highlight into a different color when you do a "MouseOver" on the link itself. I know this involves the use of Javascript and I am not looking for someone to do my programming for me. But If someone could give me some guidance it would be greatly appreciated.

:)

2 replies

by ed woychowsky

Call the following function from the body tag’s onload event handler. What it does is set an onmouseover and an onmouseout event handler for each of the anchors on the page. Hope this helps.

function setRollover() {
for(var i=0;i < document.getElementsByTagName('a').length;i++) {
document.getElementsByTagName('a').item(i).onmouseover = new Function('this.style.color = \'#FF0000\'');
document.getElementsByTagName('a').item(i).onmouseout = new Function('this.style.color = \'#0000FF\'');
}
}

This discussion is closed to new replies.