473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

dynamic images

Hello

How do I get the alt tag of an image to appear in a textbox?
this is what I'm trying

function addsmile(image_name) {
var smiley;
smiley = document.image_name.alt; // <= THIS RULE SHOULD BE CORRECTED!!!!!
doc_content = document.form.bericht.value + smiley;
document.form.bericht.value = doc_content;
document.form.bericht.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;

thank you very much for any help!


Jul 20 '05 #1
1 2456
"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.'
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Perttu Pulkkinen | last post by:
I use database to store images. So img-tags are like <img src="viewer.php?img_id=100"> Can I use javascript/php-combination to preload images of whole site after first page is loaded? Or does...
5
by: K | last post by:
I have found a script online that I want to use (I am new to PHP). It creates dynamic images based on the text that you pass it. However, no matter how I try, I can't get anything other than a...
5
by: Travis Pupkin | last post by:
Hey, I've done a number of product catalogs/galleries with one or two category levels (Category > Subcategory). The straightforward way to do this, of course, is to use database fields for...
3
by: JOSEPHINE ALVAREZ | last post by:
I have this code that I want to use to do a rollover. However, because the company I am doing it for is continually changing the text, I want to be able to use dynamic text to change the text on...
3
by: Ken Varn | last post by:
I have an ASP.NET page that draws over 32 dynamic images using an HttpModule object through the <IMG> tag. Since IIS under Win2K Pro has a limit of 10 connections, some of the images do not get...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
1
by: richardgroen | last post by:
Hi all, I got one brainteaser (well...for me). I have a database with, lets say 100 images, these images are 'dynamic' e.g. it can be 100 but also 151 images. My question is: How can i...
0
sumaiya
by: sumaiya | last post by:
I have bought a flash template and hve made it dynamic ie it has dynamic text but now i want to have dynamic images as well. The code that I have for the same is working but whn i use it in the...
0
by: javasachin | last post by:
Dear Friends, I have a requirement like this: In my JSP Page, I want to display some dynamic Arrow Images. While clicking on each of these Arrow Images, I want them to expand and create some...
3
by: =?Utf-8?B?UiBSZXllcw==?= | last post by:
Hi! This discussion may help other programmers get a better idea of how to save uploaded images through a website. Why? Well currently, I save 3 versions of every uploaded image on my own...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.