如何从 Dashcode 中的圆角矩形列表获取行值?
我是 dashcode 的新手,并尝试使用它为 iphone 构建一个简单的网络应用程序。我的主要目标是拥有一个矩形列表(我使用了“圆角矩形列表”)。它是一个静态列表,具有三行。我想要的是当用户单击任何行时打开一个网站,并且每行都有不同的 URL。我能够添加一个包含三个静态行的圆角矩形列表,例如
对象 ID 为“列表”
第 1 行--标签-“礼品卡”,值-“http://www.abcxyz.com/giftcard”
第 2 行- - 标签 - “玩具”,值 - “http://www.abcxyz.com/toys”
第 3 行 - 标签 - “自行车”,值 - “http://www.abcxyz.com/bikes”
我添加了 onclick 甚至调用 java 脚本函数,如下所示,
function myButtonPressHandler(event)
{
var websiteURL = "http://www.abcxyz.com/giftcard";
location = websiteURL;
}
当用户单击时,上面的代码会打开相同的 URL“http://www.abcxyz.com/giftcard”三个按钮中的任何一个,但我想要的是在运行时获取每个子节点的值(这将是它们各自的 URL)并使用 location = WebsiteURL 打开它,如下所示(对我不起作用:( -
function myButtonPressHandler(event)
{
var websiteURL = document.getElementById("list").children;
var WebURL = websiteURL[???].value;
location = WebURL;
}
Any帮助将是赞赏。 谢谢
I am new to dashcode and trying to build a simple web app for iphone using it. My primary aim is to have a Rectangular List (I have used the "Rounded rectangle list"). It is a static list and has three rows. What I want is a website to open when user clicks on any of the row, and each row would have a different URL. I was able to add a Rounded rectangle list with three static rows like
The object ID is "list"
Row 1-- Label- "Gift Cards" , Value - "http://www.abcxyz.com/giftcard"
Row 2-- Label- "Toys" , Value - "http://www.abcxyz.com/toys"
Row 3-- Label- "Bikes" , Value - "http://www.abcxyz.com/bikes"
i added onclick even to call a java script function like below
function myButtonPressHandler(event)
{
var websiteURL = "http://www.abcxyz.com/giftcard";
location = websiteURL;
}
the above code opens the same URL "http://www.abcxyz.com/giftcard" when the user clicks on any of the three buttons, but what I want is to fetch the value of each child node (which would be their respective URLs) at runtime and open it using location = WebsiteURL something like below (did'nt work for me :( -
function myButtonPressHandler(event)
{
var websiteURL = document.getElementById("list").children;
var WebURL = websiteURL[???].value;
location = WebURL;
}
Any help would be appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

好吧...所以想出了我自己的答案。圆角矩形列表实际上是一个多维数组。因此,要获取每行的值(即 Http URL)并在触摸/点击/按下行时在浏览器上打开它们,如下所示。
欢呼!
OK ... so figured out my own answer. The Rounded Rectangular list is actually a multidimensional array. so to get the value of each of the rows i.e. the Http URLs and open them on the browser when the rows were touched/tapped/pressed is as below.
Hurray!