winform.button.oncommand = function(id,event){ if(winform.button.text == "开始"){ winform.button.text = "停止" myfunc() } else winfom.button.text = "开始" } myfunc = function(){ while(win.delay(1)){ if(winform.button.text == "开始") break; } }