<canvas height="135" width="700" debug="true">
<debug x="200"/>
<button x="15" y="15"
onclick="Debug.write(canvas.theField.getText());">
Get Text
</button>
<button x="100" y="15"
onclick="canvas.theField.setText('Hello, Laszlo!');">
Set Text
</button>
<button x="180" y="115"
onclick="addText();">
Add Text
</button>
<script> //在<canvas>中使用script,在其中可以定义函数,用法同javascript,通过组件的name属性可以调用不同的组件
function addText() {
var origText = canvas.theField.getText();
var newText = origText + " And on.";
canvas.theField.setText(newText);
}
</script>
<text x="45" y="60" width="150" height="75" multiline="true"
name="theField">Some sample text.</text>
</canvas>
laszlo学习
最新推荐文章于 2025-08-28 16:52:32 发布

1408

被折叠的 条评论
为什么被折叠?



