Hi All,
I'm trying to make an image rollover script work by using the "same" functions (Iswap) and (Iback) for 2 different variables(?) ovr,nrm and ovrB,nrmB.
The script below works for the first set-(ovr,nrm) but I need to know how to make it work for the second set-(ovrB,nrmB)as well.
How do I add these in to the Iswap and Iback functions to make them both work?
Thanks...
function PreloadImages(length, path, type) {
for(var i = 1; i<=length; i++) {
this= new Image()
this.src= path + i + type
}
return this
}
ovr=new PreloadImages(10,'images/sub1butovr','.gif')
nrm=new PreloadImages(10,'images/sub1but','.gif')
ovrB=new PreloadImages(10,'images/sub2butovr','.gif')
nrmB=new PreloadImages(10,'images/sub2but','.gif')
function Iswap(no){
if (document.images){
eval('document.images["nrm'+no+'"].src ='+'ovr[no].src')
}
}
function Iback(no){
if (document.images){
eval('document.images["nrm'+no+'"].src ='+'nrm[no].src')
}
}
I'm trying to make an image rollover script work by using the "same" functions (Iswap) and (Iback) for 2 different variables(?) ovr,nrm and ovrB,nrmB.
The script below works for the first set-(ovr,nrm) but I need to know how to make it work for the second set-(ovrB,nrmB)as well.
How do I add these in to the Iswap and Iback functions to make them both work?
Thanks...
function PreloadImages(length, path, type) {
for(var i = 1; i<=length; i++) {
this= new Image()
this.src= path + i + type
}
return this
}
ovr=new PreloadImages(10,'images/sub1butovr','.gif')
nrm=new PreloadImages(10,'images/sub1but','.gif')
ovrB=new PreloadImages(10,'images/sub2butovr','.gif')
nrmB=new PreloadImages(10,'images/sub2but','.gif')
function Iswap(no){
if (document.images){
eval('document.images["nrm'+no+'"].src ='+'ovr[no].src')
}
}
function Iback(no){
if (document.images){
eval('document.images["nrm'+no+'"].src ='+'nrm[no].src')
}
}