This seems like it could be accomplished with this following small adjustment.
Update:
Seemed too long for you, shorthand better?
var myObj = {
myval: function(val){
return (typeof (val) === 'undefined' ? localStorage.myvalue : localStorage.myvalue=val);
}
}
Than calling it like this to set
myObj.myval("Add this");
or to get
myObj.myval();
Fiddle: http://jsfiddle.net/4WsNx/
Hope this helps.