我在跨平台解决方案(iOS,Android,MobileWeb)中使用Appcelerator。我希望能够在mobileweb中查看我UI元素的id属性。我见过如何使用Alloy设置id的例子,但我没有使用Alloy,我在JavaScript中编写了所有元素。如何在不使用Alloy时设置Appcelerator(mobileweb)中的DIV属性ID
有人可以告诉我,我必须适用于一个视图的HTML属性设置在生成的DIV的属性。
下面是一个例子观点:
this.Viewer = Ti.UI.createScrollView(
{
left:25,
right:5,
bottom:5,
top: 0,
width: this.App.Width - 40,
height: 200,
contentHeight: Ti.UI.SIZE,
borderColor: "#333333",
borderWidth: 3,
horizontalWrap: false,
layout:"vertical",
scrollType: "vertical",
scrollsToTop: true,
showVerticalScrollIndicator: true,
showHorizontalScrollIndicator: false,
verticalBounce: false,
visible: true,
zIndex:100
});
和生成的HTML
<div class="TiUIElement TiUIView TiLayoutsComposite" data-widget-id="Ti.UI.View:36" style="background-color: rgb(0, 255, 0); background-repeat: no-repeat; background-size: 100% 100%; border-color: rgb(51, 51, 51); border-width: 2px; left: 5px; top: 90px; width: 507px; height: 626px;"></div>
理发师你的男人! - 当他提到这个例子时,请注意,当你明确指出MobileWeb时,你可以将任何标准浏览器JavaScript放入该语句中。这包括对窗口和文档对象的引用等 –