I'm using the following image rollover script, but I would like to add 1 small thing.
When the user clicks the link embedded in the rollover, I'd like the image to be permanently the second image (the rollover) - like the VLINK function in the <BODY> tags (there is also an embedded pop-up window function in the link):
Here's the image tag:
<a href=" onclick="image1.src='../../images/news_1_blue.gif';NewWindow(this.href,'name','600','600','yes');return false"><IMG hspace=0 src="../../images/news_1_gray.gif" name=image1 class="domroll ../../images/news_1_blue.gif"></a>
function domRollover() {
if (navigator.userAgent.match(/Opera (\S+)/)) {
var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
}
if (!document.getElementById||operaVersion <7) return;
var imgarr=document.getElementsByTagName('img');
var imgPreload=new Array();
var imgSrc=new Array();
var imgClass=new Array();
for (i=0;i<imgarr.length;i++){
if (imgarr.className.indexOf('domroll')!=-1){
imgSrc=imgarr.getAttribute('src');
imgClass=imgarr.className;
imgPreload=new Image();
if (imgClass.match(/domroll (\S+)/)) {
imgPreload.src = imgClass.match(/domroll (\S+)/)[1]
}
imgarr.setAttribute('xsrc', imgSrc);
imgarr.onmouseover=function(){
this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
}
imgarr.onmouseout=function(){
this.setAttribute('src',this.getAttribute('xsrc'))
}
}
}
}
domRollover();
</script>
Thanks so much for any help!
Ethan Altaratz
When the user clicks the link embedded in the rollover, I'd like the image to be permanently the second image (the rollover) - like the VLINK function in the <BODY> tags (there is also an embedded pop-up window function in the link):
Here's the image tag:
<a href=" onclick="image1.src='../../images/news_1_blue.gif';NewWindow(this.href,'name','600','600','yes');return false"><IMG hspace=0 src="../../images/news_1_gray.gif" name=image1 class="domroll ../../images/news_1_blue.gif"></a>
function domRollover() {
if (navigator.userAgent.match(/Opera (\S+)/)) {
var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
}
if (!document.getElementById||operaVersion <7) return;
var imgarr=document.getElementsByTagName('img');
var imgPreload=new Array();
var imgSrc=new Array();
var imgClass=new Array();
for (i=0;i<imgarr.length;i++){
if (imgarr.className.indexOf('domroll')!=-1){
imgSrc=imgarr.getAttribute('src');
imgClass=imgarr.className;
imgPreload=new Image();
if (imgClass.match(/domroll (\S+)/)) {
imgPreload.src = imgClass.match(/domroll (\S+)/)[1]
}
imgarr.setAttribute('xsrc', imgSrc);
imgarr.onmouseover=function(){
this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
}
imgarr.onmouseout=function(){
this.setAttribute('src',this.getAttribute('xsrc'))
}
}
}
}
domRollover();
</script>
Thanks so much for any help!
Ethan Altaratz