Closed Bug 129609 Opened 23 years ago Closed 23 years ago

Cannot change image ALT tag contents with JavaScript

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: edward.kuns, Assigned: jst)

Details

I'm scripting a collapsable menu system. Part of this involves an image that changes from a right pointing arrow (for a collapsed menu where you just see the title) to a down pointing arrow (for an expanded menu). While changing the the image, I would also like to change the ALT tag contents to reflect the current status of the menu. IE 5.5 supports modifying the ALT tag contents, but Mozilla 0.9.8 does not seem to. That is, my JavaScript does the following inside a function called from an "A" tag: var thisImg = document.images[_ImgName]; thisImg.src = collapsedImg.src; thisImg.alt = "Collapsed"; Modifying thisImg.src works perfectly, but I don't see changes in the ALT attribute. When one is changing an image, it only makes sense to also update the ALT tag to update those using lynx or other folks not seeing the images.
Browser, not engine ---> DOM Level 0. Edward, could you attach a reduced testcase to this bug via the "Create a New Attachment" link above? Thanks, that will speed things along -
Assignee: rogerl → jst
Component: JavaScript Engine → DOM Level 0
QA Contact: pschwartau → desale
Sadly, I cannot reproduce this bug. This is what I get for waiting several days before going to Bugzilla. My idiocy. I've changed too many things since then to know what could have caused this. Might as well change this to WORKSFORME and if I can somehow recreate this issue I'll open a new bug. In case you're interested, the failed case is an IMG tag wrapped inside an A tag. The IMG tag did not have any JavaScript in it. The A tag had href= referencing the pseudo protocal javascript: to call a function to do the work of changing things. It also has onMouseOver and onMouseOut. I struggled with referencing the image by ID, Name, whatever, finally settled on what you see in my first post. (The stuff I'm coding has to work in IE5+ and NS6+ including Mozilla. One of these -- I forget which one -- wouldn't find the image when the image tag had 'id="myimageid"' and no 'name="myimageid"' tag and when I was using document.getElementById("myimageid")) Still, I cannot reproduce the problem now. My bad for not going to Bugzilla immediately.
Edward: not to worry, the same thing has happened to me many times. It's maddening to try and recreate a failure that no longer happens! As you suggested, I'm going to mark this WORKSFORME for now. If the scenario reappears, please reopen this bug and attach a reduced testcase; thanks -
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.