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>
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>