HTML5 provides two new ways to store data on the client:
Previously, these were done by Cookie. But cookies are not suitable for a large amount of data storage, because they are passed by each request for the server, which makes the cookies slow and efficient.
In HTML5, the data is not transmitted by each server, but only uses data when request. It is possible to store a large amount of data without affecting the performance of the website.
For different websites, data are stored in different areas, and a website can only access its own data.
HTML5 uses JavaScript to store and access data.
The data stored in the LocalStorage method has no time limit. After the second, second or next year, the data is still available.
<! Doctype html> <html> <head> <Title> </title> <meta charset = UTF-8> <script src = http://libs.baidu.com/jquery/1.9.1/jquery.min. js> </script> </head> <STyle Type = Text/CSS> Form {Width: 300px; Padding: 10px 0px 20px 30px; Height: Border-Radius: 6px; Border-Left: 8px Soli d #19A049; Background: #eee; Margin: 100px Auto;} #User, #PASS {padding: 8px; outline: none; background: transparent; 1px solid #999; : 5px;} #Sub {padding: 6px; Outline: None; Border: None; Background: #19A049; COLOR: #fff; width: 150px; border-radius: 6px; CURSOR: Pointer;} </style> <form> <form action = me Thod = onsubmit = Return loginbtn_click (); <h3> log in </h3> <input type = text name = user Placeholder = User ID = User> <input Type = Password Name = Pass Placeholder = Password = PA ss> <input type = Checkbox ID = Remember Checked> <br/> <br/> <input type = submit id = sub> </body> </body> <script type = text/javascript> $ (document). READY (function () {Var s trce = LocalStorage.getITEM ('Keyname'); Var Strpass = LOCALSTRAGE.GetITEM ('keypass'); if (strName) {$ ('#user'). Val (Strname); f (strpass) {$ ('#PASS '). Val (strpass);}}); Function loginbtn_click () {var strname = $ ('#user '). VAL Strpass = $ ('#Pass'). Val (); LOCALSTORAG E.Setitem ('Keyname', Strname); if ($ ('#Remember'). Is (': Checked')) {localStorage.Setitem ('keypass', strpass);} Else {localstorage .removeItem ('Keypass'); }} </script> </html>The above is all the contents of this article. I hope it will be helpful to everyone's learning. I also hope that everyone will support VEVB Wulin.com.