Switch image by variable with Javascript -


i'm writing image gallery script in thumbnail currently-viewed image indicated smaller image below thumbnail. placeholder follows:

<img name="indicator0" alt="indicator> 

with indicator1, indicator2, etc. following. in script, placeholder has indicator called variable thumbindicator. i'd able this:

document.(thumbindicator).src = "indicator_image.jpg"; 

but has not worked. i've changed image placeholder this:

<img id="indicator0" alt="indicator"> 

and script this:

document.getelementbyid(thumbindicator).src = "indicator_image.jpg"; 

but hasn't worked either.

i have been designing websites while now, have fair amount of experience php/mysql, new javascript. appreciated.

you need set id of placeholder image, (which might doing, not in code above).

<img id="thumbindicator" alt="alternate text" /> 

then it:

document.getelementbyid("thumbindicator").src = "newfile.png"; 

in above code, getelementbyid had both , d capitalized, is, though.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -