Showing posts with label get Session in Javascript. Show all posts
Showing posts with label get Session in Javascript. Show all posts

Thursday, 28 June 2012

SESSION IN JAVASCRIPT


Session in Javascript



<script type=”text/javascript”>
 //To set Session
function Setsession() {
    if (window.sessionStorage) {
       sessionStorage.setItem(“key1″, document.getElementById(‘<%= Write.ClientID %>’).value);               
    }
}

//To get Session
 
function GetSession() {
     if (window.sessionStorage) {
         document.getElementById(‘<%= Get.ClientID %>’).value = sessionStorage.getItem(“key1″);
      }
}


</script>



To get Session Value using javascript

 <script type=”text/javascript”>
var session = '<%= Session["VALUE"] %>'; 

</script> 

Total Pageviews