将字符串值从一个html传递给另一个html(Phonegap)

时间:2013-02-01 09:51:57

标签: javascript html html5 cordova

我是Html语言的新手,我正在尝试使用它开发PhoneGap应用程序,我想在我的主菜单(索引)中有4个选项,并且取决于用户从xml加载特定数据的选项。为了加载特定的数据,我需要保存一个字符串,区分用户选择的选项,并帮助我在xml中查找数据。

我该怎么做?我也听说过PhoneGap为这种情况提供的一些内存,虽然找不到任何东西,谢谢!

1 个答案:

答案 0 :(得分:8)

我们使用localStorage

将值从一个页面传递到另一个页面
/* Page A */
window.localStorage.setItem("id", "stringValue");

/* Page B */
var stringValue = window.localStorage.getItem("id");