简体   繁体   中英

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. 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

Unless you are using some form of storage (Local Storage, cookies, etc) the page will always reset. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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