Forum Moderators: open

Message Too Old, No Replies

image path being displayed instead of image itself

         

Andygt02

12:30 am on Aug 5, 2009 (gmt 0)

10+ Year Member



Hey guys, I'm really new to JS and can't do much more than tinker with existing code, but I'm learning.

I've created a flash interface where an image path is defined in the actionscript for several buttons. The JS gets this path through a variable called flashTools. When I call flashTools, I end up getting the path to the image, not the image itself. Code:

// MARK 1
if(flashTools!=undefined){
objTools.style.display = 'block';

objTools.innerHTML = flashTools;

} else {
objTools.style.display = 'none';
}

So for example, button one on the flash interface will display "images/tools/1.gif", button two will display "images/tools/2.gif", etc)

If I do objTools.innerHTML = <img src='images/tools/ps.gif'>", I get an image, but it will always be the same one.

I just want a way to tell it that "flashTools" is an image and not text. Thoughts?

eelixduppy

1:52 am on Aug 6, 2009 (gmt 0)



Hello and Welcome to WebmasterWorld!

Why don't you just use the image URI for the src of an image tag? See the following:


objTools.innerHTML = '<img src="' + flashTools + '" alt="Alt text here" />';

See if that helps. :)