php - Change Caption of Label -
i'm trying change caption label dinamically, doesn't change. have debugged , variable isn't null. here code:
the html file load xml , js files....
here xml file:
<?php <object class="mpage1" name="mpage1" baseclass="mpage"> <property name="designconfigname">iphone - vertical (320x480)</property> <property name="designconfigwidth">320</property> <property name="designconfigheight">480</property> <property name="usebackground">1</property> <property name="animations">a:0:{}</property> <property name="background"></property> <property name="caption">mpage1</property> <property name="font"> <property name="family">helvetica, arial, sans-serif</property> <property name="size">16px</property> </property> <property name="height">480</property> <property name="hiddenfields">a:0:{}</property> <property name="name">mpage1</property> <property name="width">320</property> <property name="jsonajaxcallcomplete">mpage1ajaxcallcomplete</property> <property name="jsonload">mpage1load</property> <object class="mbutton" name="mbutton1" > <property name="animations">a:0:{}</property> <property name="caption">teste</property> <property name="height">43</property> <property name="left">99</property> <property name="name">mbutton1</property> <property name="top">57</property> <property name="width">150</property> <property name="jsonclick">mbutton1click</property> </object> <object class="mlabel" name="mlabel1" > <property name="animations">a:0:{}</property> <property name="caption">dsadasdsa</property> <property name="font"> <property name="family">helvetica, arial, sans-serif</property> <property name="size">16px</property> </property> <property name="height">115</property> <property name="left">77</property> <property name="name">mlabel1</property> <property name="top">175</property> <property name="width">195</property> </object> </object> ?>
and here javascript:
function showrecords() { results.text = ''; db.transaction(function(tx) { tx.executesql(selectallstatement, [], function(tx, result) { dataset = result.rows; (var = 0, item = null; < dataset.length; i++) { item = dataset.item(i); var texto= item['nome'] + ' , ' + item['estoque']; var areadetexto = document.getelementsbyname('mlabel1'); areadetexto.caption = texto; // alert(areadetexto.value)); } }); }); }
var areadetexto = document.getelementsbyname('mlabel1'); areadetexto.caption = texto;
areadetexto collection , cannot set caption collection. you'll need loop through collection change captions individually. (there may other errors..)
added assuming else working, can loop through elements (separately current loop) using:
var areadetexto = document.getelementsbyname('mlabel1'); (var j = 0; j < areadetexto.length; j++) { areadetexto.caption = "some caption"; }
but i'm making lot of assumptions here; in particular, can change caption in way.
Comments
Post a Comment