如何保存变量javascript? [英] How to save a variable javascript?

查看:97
本文介绍了如何保存变量javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在运行此脚本,因此我希望能够在脚本完成运行后保存变量 stopNumber ,以便下次我运行此脚本时,已保存的变量 stopNumber 可以设置为变量 loops ,这样我就不必一直手动设置它.

So im running this script and i want to be able to save the variable stopNumber after the script is finished running so that the next time i run this script the saved variable stopNumber can be set to the variable loops so that i dont have to manually set it all the time.

var loops = Number(prompt("Starting csv line?"));
var stopNumber = loops + 15;

for (csvLine = loops ; csvLine <= stopNumber ; csvLine++) {

iimSet ("-var_CSVLINE", csvLine);
iimPlay("Testing.iim");

}

推荐答案

您可以将值存储在本地存储中

You can store the value in local storage

localStorage.setItem("stopNumber", stopNumber);

使用

stopNumber = parseInt(localStorage.getItem("stopNumber"));

更多信息在这里 http://www.w3schools.com/html/html5_webstorage.asp

这篇关于如何保存变量javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆