简体   繁体   English

Javascript重置其代码?

[英]Javascript resets its code?

I'm working on a website that ask question and then gives a answer and I'm wondering after one set of questions being asked user will be re directed to the next page to answer more questions so my question is will the javascript will reset. 我正在一个问问题然后给出答案的网站上工作,我想知道在询问了一组问题之后,用户将被重定向到下一页以回答更多问题,所以我的问题是将重置JavaScript。 So let say when the user press the button it will turn blah to true will it return to false if I re direct the user to a new page 所以可以说,当用户按下按钮时,如果我将用户重新定向到新页面,它将变为true,然后返回false

Unless you are using some form of storage (Local Storage, cookies, etc) the page will always reset. 除非您使用某种形式的存储(本地存储,Cookie等),否则该页面将始终重置。 Even if you use storage it will require work to bring it out of storage as well. 即使您使用存储,也需要进行工作才能将其带出存储。

Every time you go to a page the associated JavaScript will run as if its the first time its ever ran. 每次您访问页面时,关联的JavaScript都将像第一次运行时一样运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM