Need help disabling rollovers while in a clicked state. Javascript is not my strong point - I have found help on this site which brought me to the following code - all works well. But I can't seem to disable the rollover when the button is clicked.
My HTML code is -
Code:<a href="#"><img src="images/button1_off.png" width="175" height="70" border="0" alt="button1" id="button1" /></a>
Here is my external JS script.
Any help would greatly be appreciatedCode:window.onload = rolloverInit; function rolloverInit() { for (var i=0; i<document.images.length; i++) { if (document.images[i].parentNode.tagName == "A") { setupRollover(document.images[i]); } } } function setupRollover(thisImage) { thisImage.outImage = new Image(); thisImage.outImage.src = thisImage.src; thisImage.onmouseout = rollOut; thisImage.clickImage = new Image(); thisImage.clickImage.src = "images/" + thisImage.id + "_click.png"; thisImage.onclick = rollClick; thisImage.overImage = new Image(); thisImage.overImage.src = "images/" + thisImage.id + "_on.png"; thisImage.onmouseover = rollOver; } function rollOver() { this.src = this.overImage.src; } function rollOut() { this.src = this.outImage.src; } function rollClick() { this.src = this.clickImage.src; } function rollClick() { if(lastClick){ lastClick.onmouseout = rollOut; lastClick.src = this.outImage.src; } this.src = this.clickImage.src; this.onmouseout = rollClick; lastClick = this; } var lastClick = null;![]()


Reply With Quote
Bookmarks