Re: (simple?) DOM problem
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: (simple?) DOM problem

From: Evertjan. <exjxw.hannivoort@interxnl.net>
Date: Wed Feb 08 2006 - 18:58:55 CET

bmgz wrote on 08 feb 2006 in comp.lang.javascript:

> function viewPhoto(thumb){
> document.getElementById('mainPhoto').src=thumb.href;
> thumbs =
> document.getElementById('property-thumbnail-browser').getElementsB
> yTagName('img'); for(i=0; i<thumbs.length; i++){
> < If this is the image i clicked on > <-- I need to find the
> Index of the object???
> thumb.firstChild.className="thumbnail-current";
> < Else >
> thumbs[i].className="thumbnail-normal";
> }
>
> return false;
>}
>

var which = false;

function viewPhoto(thumb){
        document.getElementById('mainPhoto').src = thumb.src;
             if (which)
         which.firstChild.className = "thumbnail-normal";
        thumb.firstChild.className="thumbnail-current";
        which = thumb;
        return false;
}

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Received on Mon May 1 03:10:32 2006