Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.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
Javascript 如何为“分配值”;“文本”;“的财产”;someText“;动态js中的对象?_Javascript_Html_Kineticjs - Fatal编程技术网

Javascript 如何为“分配值”;“文本”;“的财产”;someText“;动态js中的对象?

Javascript 如何为“分配值”;“文本”;“的财产”;someText“;动态js中的对象?,javascript,html,kineticjs,Javascript,Html,Kineticjs,下面是代码:实际上我正在使用一个循环,我想在其中为“text”属性赋值 var someText=new Kinetic.Text({ x:stage.width()-50, y:stage.height()/4, text:9, //i want to change value of this property fill:'green', fontSize:14, fontFamily:'Verdana' }); someText.text()

下面是代码:实际上我正在使用一个循环,我想在其中为“text”属性赋值

var someText=new Kinetic.Text({
    x:stage.width()-50,
    y:stage.height()/4,
    text:9, //i want to change value of this property
    fill:'green',
    fontSize:14,
    fontFamily:'Verdana'
});

someText.text()=19;  // here is the error fires
“无效分配左侧”
在上述语句中触发错误。请帮忙?如果我执行
alert(someText.text())
它工作正常并且显示
9

请尝试此代码

someText.text("19"); 

您尝试设置文本的方式无效。尝试:

someText.setText('19');