Saturday, 23 March 2013

Web storage


<!Doctype html>
<html>
   
<head>
    <script type="text/javascript">
        var key='string';
        function pageLoad()
        {
           
        }
       
        function loadNextPage()
        {
            window.localStorage.setItem("FN",'Smith');
            window.localStorage.setItem("LN",'John');
            window.localStorage.setItem("CITY",'Pune');

            window.sessionStorage.setItem("F",'Asif');
            window.sessionStorage.setItem("L",'Ali');
            window.sessionStorage.setItem("C",'Nagpur');

            /*window.location.href="webstorage2.html";    */
        }

        function GetLocal()
        {
            alert(window.localStorage.getItem("FN"));
            alert(window.localStorage.getItem("LN"));
            alert(window.localStorage.getItem("CITY"));
        }
       
        function GetSession()
        {
            alert(window.sessionStorage.getItem("F"));
            alert(window.sessionStorage.getItem("L"));
            alert(window.sessionStorage.getItem("C"));
        }

        function Nav()
        {
            window.location.href="webstorage2.html";
        }

    </script>
</head>

<body onload='pageLoad()'>

   <input type="button" onclick='loadNextPage()' value="Set Storage"/>
   <input type="button" onclick='GetLocal()' value="Get Local Storage"/>
   <input type="button" onclick='GetSession()' value="Get Session Storage"/>

   <input type="button" onclick='Nav()' value="Navigate"/>
   

</body>



</html>

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home