Computing.Net > Forums > Web Development > Change Image Title w/JavaScript

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Change Image Title w/JavaScript

Reply to Message Icon

Name: Michael J (by mjdamato)
Date: September 18, 2005 at 12:25:34 Pacific
OS: XP
CPU/Ram: N/A
Comment:

Anyone have any idea how to change an image's title attribute with JavaScript? For example if I have an image such as this
     then what is the proper way to reference that title?

document.getElementById("123").???="New Title";

What do I use in place of "???"?



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: September 18, 2005 at 12:26:45 Pacific
Reply:

The image code was parsed even though I escaped the brackets. Here it is again:

[img src="img.jpg" title="The Title" id="123"]


0

Response Number 2
Name: Michael J (by mjdamato)
Date: September 19, 2005 at 09:56:54 Pacific
Reply:

Never mind,

document.getElementById("imageID").title="New Title";

Thought I had tried that and it didn't work. but after some more research I found it listed on a site and it worked! Must have had an error in my code previously.

Michael J


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Change Image Title w/JavaScript

Hide page scrollbars w/ javascript www.computing.net/answers/webdevel/hide-page-scrollbars-w-javascript/2916.html

Changing Page Title with templates www.computing.net/answers/webdevel/changing-page-title-with-templates/2537.html

Include and change image www.computing.net/answers/webdevel/include-and-change-image/664.html