/    Sign up×
Community /Pin to ProfileBookmark

Name attribute

Zello Hello,
I am a beginner with Javascript, but have some understanding. I have an image that I am trying to be a target for mouseovers. I can’t find how to assign this image multiple names so that as you mouseover the different links, a different but cooresponding image will appear. Currently I am using one script an have assigned the image an “id” and another script assigned a “name”. This works for 2, but won’t be a final result. Any help would be appreciated.

-tB

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@mrhooOct 07.2006 — You don't need to change the id of your image, but its src attribute, and

perhaps the width and height attributes, if your images differ in size.
Copy linkTweet thisAlerts:
@ZEMPCOauthorOct 07.2006 — That is info that is helpful, but not quite right. The link has to point itself to the ID of the image to be changed. How is changing the source file without distinguishing where it came from or is heading o work? I mentioned, it actually worked when I gave the destination file(image) both the attribute "name" and "id", but this only will work twice. My question really is, can I give the destination file multple ID's or Names, and how? In quotes

ie: name="artists";"artists1";"artists2" or

name="artists;artists1;artists2"


-tB
Copy linkTweet thisAlerts:
@mrhooOct 07.2006 — There are two contexts involved when working with images-

the [B]document.images [/B] array, which can include new Image objects that are not children of the document body,and the collection of html image elements, [B]document.getElementsByTagName('img')[/B] which are descendents of the body.

The context that supports name and id is the html collection.

If you want a single image element on the page to display different

source files when you mouseover different links, you don't change the

name of the <img> element, you change the src attribute of the element to point to the url of the file that applies to the hot link.

The links handle the mouseover,

getting the new src url from an images array,

or from an attribute of the calling link,

and setting a new src for the image element.
Copy linkTweet thisAlerts:
@ZEMPCOauthorOct 07.2006 — Once again you have insightfully given info that is helpful and I believe I understand. But I found this script and have used it much. I didn't write it, but over time feels like it was mine. There isn't an array attribute actually in the script at this point, but this tag refers to the image src, currect. I haven't written one(copied a preload script that uses one as well as a self changing rotation of images script) and with the current script it would work the way I am doing it IF you could change the name="" attribute. If that isn't possible I am not sure what to do for the script.

I am sure that it can be done.

www.zempco.com/artists123.html --- referring to the links in the lefthand table

THANKS, -tB

PS. I have edited 3 times now. I read through your note again. I think I agree, but you have mention of items to be in the script that I don't have or don't know how to use. My destination "URL" is an image whose code is common as.. <img src="images/123.bmp" [COLOR=Sienna]name="artists" [/COLOR]>. The name attribute is what is the destination here. But I was trying to coordinate a 2nd and etc. name to fit with the changes to the .src file's name. That can't be done? Seeing that you can only mouse one event at a time, I thought this should work since no more than one name or id would be asked at a time.
Copy linkTweet thisAlerts:
@ZEMPCOauthorOct 08.2006 — Thanks for helping. I found away to get what I need the site to do. If your interested, the site address is:

www.zempco.com

and is on the page entitled "artists"
×

Success!

Help @ZEMPCO spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...