![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
function SaveCSS(sElement) { /* store current css properties */ adminSaveState[sElement] = document.getElementById(sElement); Here, all you save is a reference to the DOM node. } |
|
I tried this: function getCSSState(id) { var srcStyle = document.getElementById(id).style; var dstStyle = {}; for (var i in srcStyle) { dstStyle[i]=srcStyle[i]; } return dstStyle; } function setCSSStyle(id,srcStyle) { var dstStyle = document.getElementById(id).style; for (var i in dstStyle) { dstStyle[i]=srcStyle[i]; // sets to undefined if not in srcStyle } for (i in srcStyle) { if (dstStyle[i] === undefined) { dstStyle[i]=srcStyle[i]; // sets those not in dstStyle, if any. } } } It works - kindof - in IE and Mozilla, but not in Opera. The properties are not enumerable. |
![]() |
| Thread Tools | |
| Display Modes | |
| |