"twopeak" <tw*****@pandora.be> writes:
Hello
How do I get the alt tag of an image to appear in a textbox?
this is what I'm trying
You should never assume that a named element can be accessed as just
"name" or "document.name". Some browsers allow it, others don't, but
it is always safer to go through the propert collections:
function addsmile(image_name) {
var smiley;
smiley = document.image_name.alt; // <= THIS RULE SHOULD BE CORRECTED!!!!!
<URL:http://jibbering.com/faq/#FAQ4_39>
smiley = document.images[image_name].alt;
doc_content = document.form.bericht.value + smiley;
document.form.bericht.value = doc_content;
var berichtElem = document.forms['form'].elements['bericht'];
berichtElem.value += smiley;
document.form.bericht.focus();
berichtEleme.focus();
}
so when a user clicks a link, it sends the name of the image to the
function, and smiley should be the alt tag of the image!
if the variable image_name = "een"
then the line should be
smiley = document.een.alt;
It should be
smiley = document.images.een.alt;
but since "een" is stored in the string called "image_name", it's
smiley = document.images[image_name].alt;
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'