向 html 表添加行时 Titanium webview 崩溃
我有带有内联 html 的 webview 作为窗口的一部分。它包含一个大约 10 行的 html 表。当我尝试向表中再添加 1 行时,应用程序崩溃了。
webView = Titanium.UI.createWebView({
scalesPageToFit:false,
top:0,
bottom:0
});
var html = '<html>'+
'<body>'+
'<table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Use RedAnar To:</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+sc+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Store Card Data</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+eo+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Explore Offers</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+cl+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Capture Loyalty</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+tp+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Track Points</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+vb+'" valign="absmiddle"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">View Balances</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Card Description</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="20" colspan="2" style="color:#000; font-size:14; font-weight:normal">'+description+'</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Highlights</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="20" colspan="2" style="color:#000; font-size:14; font-weight:normal">'+highlights+'</td>'+
'</tr>'+
'</table>'+
'</body>'+
'</html>';
webView.html = html;
如果我尝试在此之后再插入 1 行,应用程序将崩溃。有什么建议吗?
I have webview with inline html as a part of my window. It contains an html table with around 10 rows. When I try to add 1 more row to the table the app crashes.
webView = Titanium.UI.createWebView({
scalesPageToFit:false,
top:0,
bottom:0
});
var html = '<html>'+
'<body>'+
'<table width="98%" align="center" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Use RedAnar To:</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+sc+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Store Card Data</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+eo+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Explore Offers</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+cl+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Capture Loyalty</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+tp+'"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">Track Points</td>'+
'</tr>'+
'<tr>'+
'<td width="10%" height="25"><img src="'+vb+'" valign="absmiddle"></td>'+
'<td width="90%" height="25" style="color:#000; font-size:14; font-weight:bold">View Balances</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Card Description</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="20" colspan="2" style="color:#000; font-size:14; font-weight:normal">'+description+'</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="25" colspan="2" style="color:#ba2424; font-size:14; font-weight:bold">Highlights</td>'+
'</tr>'+
'<tr>'+
'<td align="left" height="20" colspan="2" style="color:#000; font-size:14; font-weight:normal">'+highlights+'</td>'+
'</tr>'+
'</table>'+
'</body>'+
'</html>';
webView.html = html;
if i try inserting 1 more row after this the app will crash. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚测试了你的代码,它起作用了(不过我已经使用你的变量作为文本,因为我不知道它们里面有什么)。
我在最后添加了以下行,它也起作用了:
当它不起作用时,您添加什么行?当它崩溃时会给出什么错误?
I've just tested your code, and it worked (I have used your variables as text though, because I don't know what's in them).
I've added the following line at the end, and it worked too:
What line do you add when it doesn't work? And what error does it give when it crashes?