Persistence behavior for HTML Tags and Adobe Dreamweaver Spry generated with javascript

D

Dan NITA

Hello,

I'm new to the java world and I attempted to use "sessionStorage" attribute
of DOM to save the entire content of my html page. By doing this I try to
obtain persistence behavior for HTML Tags generated with javascript.

For a simple page, everything work fine: all HTML Tags are recovered
correctly.

The problems appears when I use Adobe Dreamweaver Spry! To work properly,
all this Spry's need a sort of object constructor like this:

var ValidationTextField1 = new Spry.Widget.ValidationTextField(ControlName,
ControlValueType, {minValue:ControlLowLimit, maxValue: ControlLowLimit,
validateOn:["blur"]});

"ControlName, ControlValueType, ControlLowLimit, ControlLowLimit" are
dynamically modified variables. The number and the type of spry depend also
on the context.

Without this constructor the spry don't work as it should be!

The question is: How to save and recover this kind of variable using
"sessionStorage" ? It is possible to save all "body" or "document" including
javascript variables? Some others ideas?

Thank.
Dan.



Reduced CODE:

<body onload="javascript:OnLoadDocument();"onunload="OnUnloadDocument();" >

<div style="width:100%; height:100%; id="MainPage">

.... All other HTML Tags and Sprys generated with javascript .....

</div>

<script type="text/javascript">
<!-

//-------------------------------------------------
function OnLoadDocument()
{
try
{
if(sessionStorage != null)
{
var Page = document.getElementById("MainPage");

//retrieve item
var StorageItem = sessionStorage.getItem("SavedSession");

if (StorageItem != null)
Page.innerHTML = StorageItem;

}
}
catch(err)
{

}
}

//-------------------------------------------------
function OnUnloadDocument()
{
try
{
if(sessionStorage != null)
{
var Page = document.getElementById("MainPage");

//retrieve item
var StorageItem = sessionStorage.getItem("SavedSession");

//save a value
if (StorageItem !== Page.innerHTML)
sessionStorage.setItem("SavedSession", Page.innerHTML);
}
}
catch(err)
{

}

}

//-->
</script>

</body>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,832
Latest member
GlennSmall

Latest Threads

Top