【localStorage用法】js把变量保存到本地

来源:互联网 发布:硬妹风的淘宝店 编辑:程序博客网 时间:2024/05/29 17:52
function linkSSH() {var textSave = localStorage.getItem("textSave");//这里是取值if (textSave != null && textSave != "") {openProgram(textSave);} else {layer.prompt({title: '请输入程序路径', formType: 2}, function(text, index){$.ajax({url : getRootPath() + "/event/openProgram.do",type : "POST",data:{param:param},success : function(data) {if (data){localStorage.setItem("textSave", param);//这里是设置layer.closeAll();} else {layer.alert("打开失败,请先检查路径是否正确");}}});});}}

原创粉丝点击