im writing some javascript code that will show a “thumbnail” of a link’s webpage as the mouse is moved over said link, here is the code so far:
[CODE]anchors = document.getElementsByTagName(“a”);
thumbnailLink = “http://www.shrinktheweb.com/xino.php?embed=1&STWAccessKeyId=e756a2037c8a9ac&stwsize=lg&stwUrl=”;
for (i=0; i < anchors.length; i++){
linkhref = anchors[i].href;
anchors[i].addEventListener(‘mouseover’, function() { showThumbnail(linkhref) }, false);
anchors[i].addEventListener(‘mouseout’, hideThumbnail, false);
}
function showThumbnail(e){
alert(e);
}
function hideThumbnail(){
}
just to test i have made the showThumbnails function just output the argument to an alert box, the argument will be used to load the thumbnail once i develop the script
however, theres a problem, the link moveovers work, the alert appears, but with the same link, the last link that is on the page.
these lines are obviously not doing what i want:
[CODE]linkhref = anchors[i].href;
anchors[i].addEventListener(‘mouseover’, function() { showThumbnail(linkhref) }, false);
what should i do?
thanks