I am using prototype version 1.6.0.

Currently when updating typical (e.g. SPAN, DIV, TD, etc.) DOM
elements, a simple
  $('div1').update('new text');
would update the text of the element.  That's fine, but what about
images?

If I do that with an image tag, I would hope to be updating the src,
but it currently silently does nothing.  No error; nothing.
Temporarily, I extended all images such that when update() is called
on them, I can pass a new src attribute and that will be set.  Here's
what I did:

Element.addMethods
(
  'IMG',
  {
    update: function(element, src)
    {
      element = $(element);
      element.setAttribute('src', src);
      return element;
    }
  }
);

$('img1').update('images/newImage1.gif');

By the way, I'm aware that another workaround would be to just
directly set the attribute of any image I want by
  $('img1').setAttribute('src', 'images/newImage1.gif'');
but the point is to unify elements using the update function.

Is the original prototype update function doing it wrong for images?
If not, maybe this could be a new feature.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to