Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用phonegap for ios将数据从一个页面传递到另一个页面_Ios_Cordova_Navigationbar - Fatal编程技术网

如何使用phonegap for ios将数据从一个页面传递到另一个页面

如何使用phonegap for ios将数据从一个页面传递到另一个页面,ios,cordova,navigationbar,Ios,Cordova,Navigationbar,我是Phonegap编程新手。我使用NavigationBar插件创建了一个HTML页面ListScreen.HTML。在ListScreen中,我显示了数据列表。当我选择一个列表项时,它会转到另一个HTML页面DetailsScreen.HTML页面。我在ListScreen.HTML中尝试了以下代码: $document.onclick,lstMyList li,函数事件{ window.location.href='DetailsScreen.html'; }); 如

我是Phonegap编程新手。我使用NavigationBar插件创建了一个HTML页面ListScreen.HTML。在ListScreen中,我显示了数据列表。当我选择一个列表项时,它会转到另一个HTML页面DetailsScreen.HTML页面。我在ListScreen.HTML中尝试了以下代码:

$document.onclick,lstMyList li,函数事件{

    window.location.href='DetailsScreen.html';


    });

如何将所选项目从ListScreen.html发送到DetailsScreen.html。请帮助我。

您可以使用本地存储。我支持任何JavaScript对象

localStorage.setItem("oneKey", anObject);
var anObject = localStorage.getItem("oneKey");

这对我很有效。试试这个-

var foo = localStorage["bar"];
localStorage["bar"] = foo;

,谢谢,但当我显示alertanObject时,它会显示所选项目,但当我尝试在console中显示为console.loganObject时,它不会在console中显示任何内容。是否将对象放在那里?我将localStorage.setItemoneKey,anObject;放在ListScreen.html和var anObject=localStorage.getItemoneKey;console.loganObject I中n DetailsScreen.html则不显示控制台文本。在localStorage.setItemoneKey,anObject之前的console.loganObject中的anObject是什么,然后选中localStorage.getItemoneKey;在localStorage.setItemoneKey之后的anObject;在ListScreen.html$this.text中,这是对象表示所选列表项数据