I'm trying to set the style of elements that are created through
document.createElement() using the setStyle() function. Looks
something like this:

var newdiv = document.createElement('div');
  position: 'relative',
  width: '100px'


This works flawlessly in Opera and Firefox. They accept the newdiv
object as a valid element, event though it is not yet part of the DOM.
However, IE does not. It throws an error saying "Object doesn't
support this property or method". And yet if I use the long handed
version, it works fine:

newdiv.style.position = 'relative';
newdiv.style.width = '100px';

This completely baffles me. Why doesn't IE accept it as a valid
element for setSyle()?
This has become a great inconvenience since I'm forced to use the long
handed version, which is very ugly and cumbersome.

Does anyone know a way of fixing this error?

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 

Reply via email to