Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all,
i am passing a values between two pages/more. for that i stored a values into local storage and get into another page .where ever i want.
for that i have a code but not get the value into another page.
so help to me how can i will do this?
Thanks in advance,
nareshrajuu,

in page1.html button click logic:
-------------------------------

C#
function Button1_onclick() {
         alert("in button");
         var myValue = TextArea1.value.toString();
         localStorage.setItem("myValue", myValue);
         onclick = "location.href='page2.html'"
     }



in page2 button two (when i click on the button that value/text should displayed into
one textarea.

code as:
---------

C#
function Button1_onclick() {
    var myValue = localStorage.getItem("myValue");
    TextArea1.innerHTML = myValue;
}
Posted
Comments
Unareshraju 7-Sep-12 5:01am    
i solved
Ashraff Ali Wahab 7-Sep-12 11:56am    
I assume you solved by putting your HTML pages in a server with same domain,since local storage will not be accessible across domain or within two differnt HTML files accessed using "file://" protocol.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900