保存Javascript变量以供以后使用? [英] Saving a Javascript variable for later usage?
本文介绍了保存Javascript变量以供以后使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有办法将一个或多个javascript变量保存到本地计算机,然后再调用它们?
I was wondering if there were a way to save one or more javascript variables to the local machine and then call on them later?
var a = b
然后当你回到网页时它会记住那个值B是?
and then when you go back to the webpage it remembers the value that B was?
推荐答案
您正在寻找的是如何制作和使用 Cookies 。
What you are looking for is probably how to make and use Cookies.
cookie是一个变量存储在访问者的计算机上。每次同一台计算机通过浏览器请求页面时,它也会发送cookie。使用JavaScript,您可以创建和检索cookie值。
A cookie is a variable that is stored on the visitor's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values.
这篇关于保存Javascript变量以供以后使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文