代码语言:javascript复制
//节点绑定事件
import win.ui;
/*DSG{{*/
winform = ..win.form( bottom=399;parent=…;text=“AAuto Form”;right=599 )
winform.add(
layoutWindow={ dr=1;dl=1;bottom=382;right=580;left=10;multiline=1;top=12;notify=1;z=1;db=1;dt=1;cls=“edit” }
)
/*}}*/
import web.layout;
wbLayout = web.layout(winform.layoutWindow);
namespace web.layout.behavior.showchange{
tests=function(ltEle,a,b,c){
..io.print(“text changed:”,ltEle.innerText,ltEle.id);
}
}
wbLayout.html =/***
<div id=”my-button” >请点击这里</div>
<div id=”222″>请点击这里</div>
***/
wbLayout.css = /**
div{
behavior:~showchange edit;
value-changed!:
self.tests(1,2,3)
;
}
**/
io.open()
var layoutEle = wbLayout.getEle(“my-button”)
layoutEle.innerText=“123456aaa”
layoutEle.onMouseClick = function( ltTarget,ltEle,x,y,mouseParams ) {
io.print(“点击了节点”,ltTarget.innerHTML )
}
aaa=wbLayout.queryEles(“div”)
for(k,v in aaa){
io.print(v.innerText)
}
//调用此函数节点可响应HTML事件
layoutEle.attachEventHandler();
winform.show()
win.loopMessage();