$ function actually use document.getElementById to get the object.
This DOM method has been misunderstood by IE and Opera, it will use
the input's name as its id number and be found by getElementById
method, I hate that, so I write a bug fixed $ function:
function $(element) {
  if (arguments.length > 1) {
    for (var i = 0, elements = [], length = arguments.length; i <
length; i++)
      elements.push($(arguments[i]));
    return elements;
  }
  if (typeof element == 'string')
  {
        var id=element;
    element = document.getElementById(element);
        if(!element.id || element.id!=id)
        element=$$("*").detect(function(node){return node.id==id})
  }
  return Element.extend(element);
}
This $ function can only get the object with id attribute, I hope it
can be added into the Prototype.


--~--~---------~--~----~------------~-------~--~----~
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