This one was a SOB and as always, IE is at fault...
Here is what I found on researching this...
now this is for IE only of course..
var cell = new Element("td");
This is all well and good w/o any attributes, the Element constructor
delegates the attributes object, the second parameter to
Element.writeAttribute...
cell.writeAttribute("class", "text");
fails to work due to the attribute translations, found in the
Element._attributeTranslations.write object. IE8 is now expecting to
write to the literal "class" attribute, not the className that it gets
translated to.
cell.setAttribute("class", "text"); //this works fine in IE8
cell.addClassName("text"); //this also works but its not using element
attributes but the JS DOM reference itself, ie cell.className = ...
--
http://positionabsolute.net
On Oct 26, 4:04 pm, "Alex McAuley" <[email protected]>
wrote:
> Just as a side measure that you are probably not aware of...
>
> IE8 has a bug that when you do your new Element(td..,'class':'text'...
>
> It will not add the class to IE8 browsers ... you need to use
> addClassName('text'); after you insert it...
>
> I found this out the hard way !
>
> Alex Mcauleyhttp://www.thevacancymarket.com
>
> ----- Original Message -----
> From: "molo" <[email protected]>
> To: "Prototype & script.aculo.us" <[email protected]>
> Sent: Monday, October 26, 2009 7:27 PM
> Subject: [Proto-Scripty] onChange in Dynamic Element not working in IE6
>
> > The following code works in Firefox but the onChange/onBlur events do
> > not get triggered from the browser in IE6
>
> > Does anyone know
> > 1) How to fix this
> > 2) If I should use a different approach for dynamically building the
> > form elements
>
> > I dynamically build elements on the screen base on a button being
> > entered to call a function
>
> > var newSecurityTdInput = new Element('td' , {'class':'text'});
> > var newSecurityInput = new Element('input', {'type':'text',
> > 'class':'text newid', 'name':'newid', 'onChange':
> > "validateNewSecurityChange(this);" ,'onBlur': "getSecurityName
> > (this);"});
>
> > newSecurityTdInput.appendChild(newSecurityInput);
> > newSecurityTr.appendChild(newSecurityTdInput);
>
> > Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---