javascript userdata操作
要注意此方法只能对同一目录有效
var Session = {
isinit: false,
init: function() {
SessionObj = document.createElement('input');
SessionObj.type = "hidden";
SessionObj.id = "Sessionid";
SessionObj.style.behavior = "url('#default#userData')"
document.body.appendChild(SessionObj);
this.isinit = true;
},
save: function(sessionName, value) {
this.isinit ? '' : this.init();
if (sessionName != null && sessionName != "") {
SessionObj.setAttribute(sessionName, value)
SessionObj.save("s")
}
},
load: function(sessionName) {
this.isinit ? '' : this.init();
if (sessionName != null && sessionName != "") {
SessionObj.load("s");
return SessionObj.getAttribute(sessionName);
}
}
}
var Session = {
isinit: false,
init: function() {
SessionObj = document.createElement('input');
SessionObj.type = "hidden";
SessionObj.id = "Sessionid";
SessionObj.style.behavior = "url('#default#userData')"
document.body.appendChild(SessionObj);
this.isinit = true;
},
save: function(sessionName, value) {
this.isinit ? '' : this.init();
if (sessionName != null && sessionName != "") {
SessionObj.setAttribute(sessionName, value)
SessionObj.save("s")
}
},
load: function(sessionName) {
this.isinit ? '' : this.init();
if (sessionName != null && sessionName != "") {
SessionObj.load("s");
return SessionObj.getAttribute(sessionName);
}
}
}
浙公网安备 33010602011771号