Javascript: stores and reads cookies, and javascriptcookie
Cookie is an important technology in Web development. It is used to store some information locally (such as username, password, and logon status) so that users can use it for the next visit (or use it on other pages ). The cookie format is a key-value pair. Multiple key-value pairs are separated by semicolons, for example, name = zhangsan; age = 21.
The following code demonstrates that when you click "OK", the name and age are stored in cookies. When you access this page for the next time, the name and age are automatically entered.
Note: You must deploy the html file on a web server (such as apache) to see the effect of the cookie. It cannot be opened locally using a browser ~
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">