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

Discussion in 'Javascript' started by Dan NITA, Oct 30, 2009.

  1. Dan NITA

    Dan NITA Guest

    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>
    Dan NITA, Oct 30, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. javaguy44
    Replies:
    10
    Views:
    963
    Michael Berg
    May 18, 2004
  2. Jason
    Replies:
    25
    Views:
    8,475
    Toby Inkster
    Jan 9, 2005
  3. Kenneth P. Turvey

    Java Persistence API and persistence.xml

    Kenneth P. Turvey, Mar 15, 2008, in forum: Java
    Replies:
    2
    Views:
    17,258
    Kenneth P. Turvey
    Mar 16, 2008
  4. pplschmp
    Replies:
    2
    Views:
    1,265
    Andrew Thompson
    Jun 29, 2008
  5. charlie imac

    load adobe spry gallery

    charlie imac, Jul 30, 2007, in forum: Javascript
    Replies:
    1
    Views:
    99
    charlie imac
    Jul 31, 2007
Loading...

Share This Page