type mismatch error

wxdqz

New Member
this is my first javascript, trying to get links to switch their image (the links in question are all imgs) on mouse over.
there are probably many problems with this script, if you want to point others out that would be helpful but i'm looking to fix the current error ie throws at me:
Line: 46 ([edit:its the line with the >>>>> pointing to it])
Error: Type mismatch.
this is all in a seperate .js file



// GLOBAL variables


var IMGS = document.getElementsByTagName( 'IMG' ) ;
// directory+file file type
var REGEX1 = /(.*\/\w*)(\.(?:jpg|png|gif))/i ;
// directory+file 'v' file type
var REGEX2 = /(.*\/\w*)v(\.(?:jpg|png|gif))/i ;


// ------------------------------------
// Functions


function Navlinkimagebubble( IMGSid ) {
var currentimg = document.getElementById( IMGSid ) ;
REGEX1.exec( currentimg.src ) ;
newsrc = '$1' + 'v' + '$2' ;
currentimg.src = newsrc ;
}

function Unnavlinkimagebubble( IMGSid ) {
var currentimg = document.getElementById( IMGSid ) ;
REGEX2.exec( currentimg.src ) ;
newsrc = '$1' + '$2' ;
currentimg.src = newsrc ;
}


// ------------------------------------
// script


if ( document.addEventListener ) {
for ( iterator = 0; iterator < IMGS.length; iterator++ ) {
if ( IMGS[iterator].className == 'navlinkimage' ) {
IMGS[iterator].addEventListener( 'mouseover', Navlinkimagebubble( IMGS[iterator].id ), false ) ;
IMGS[iterator].addEventListener( 'mouseout', Unnavlinkimagebubble( IMGS[iterator].id ), false ) ;
}
}
}

else if ( document.attachEvent ) {
for ( iterator = 0; iterator < IMGS.length; iterator++ ) {
if ( IMGS[iterator].className == 'navlinkimage' ) {

>>>>>>>>>>>> IMGS[iterator].attachEvent( 'onmouseover', Navlinkimagebubble( IMGS[iterator].id ) ) ;
IMGS[iterator].attachEvent( 'onmouseout', Unnavlinkimagebubble( IMGS[iterator].id ) ) ;
}
}
}
 
Back
Top