On Aug 5, 12:46 pm, pt36 <key.albe...@gmail.comwrote:
[...]
Hi Rob
thanks for your answer and your time
Sorry.
You are right, I write not correct
my code is
onclick="photo('<img src=image.jpg>')"
Rather than setting the innerHTML, use DOM methods instead. It's poor
form to have a local variable that has the same name as the function
itself and variable names should be meaningful and reflect what they
do, so:
function showPhoto(imgSrc)
{
var el = document.getElementById('photoID');
var img = document.createElement('img');
img.src = imgSrc;
// Clear out child nodes
while (el.firstChild) {
el.removeChild(el.firstChild);
}
// Insert image
el.appendChild(img);
fade(image, true);
}
function fade(el, direction) {
/* Set the image's opacity to zero or 1 based on
** direction (true == in, otherwise out) then fade
** it using setTimeout to keep calling fade until
** it's fully visible (or not). Look in the archives
** for an opacity setting function - good ones are
** quite a bit of code.
*/
}
--
Rob