BoulderBum
Programmer
I have a setup like this:
It works with IE, but FireFox apparently loads the attribute as a string instead of an object so all that gets stored is: "[Object object]" or something like that.
Is this just the way it works, or am I missing something?
Also, is there a way to serialize an object into JSON syntax so I can store it for FireFox, then load it up with eval or something?
Code:
function MyObject()
{
this.Property = 'blah';
}
var myDiv = document.getElementById('myDiv');
myDiv.setAttribute( 'myAttribute', new MyObject() );
var objInstance = myDiv.getAttribute( 'myAttribute' );
alert( objInstance.Property );
It works with IE, but FireFox apparently loads the attribute as a string instead of an object so all that gets stored is: "[Object object]" or something like that.
Is this just the way it works, or am I missing something?
Also, is there a way to serialize an object into JSON syntax so I can store it for FireFox, then load it up with eval or something?