Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Javascript (http://www.velocityreviews.com/forums/f68-javascript.html)
-   -   Persistence behavior for HTML Tags and Adobe Dreamweaver Spry generated with javascript (http://www.velocityreviews.com/forums/t939768-persistence-behavior-for-html-tags-and-adobe-dreamweaver-spry-generated-with-javascript.html)

Dan NITA 10-30-2009 10:39 AM

Persistence behavior for HTML Tags and Adobe Dreamweaver Spry generated with javascript
 
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="OnU nloadDocument();" >

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







All times are GMT. The time now is 04:59 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.