for(var i=0;i<arr.length;i++)...{//随便一个循环生成动态table var header=tab.createTHead(); var row=header.insertRow(); var cell=row.insertCell(); cell.appendChild(document.createTextNode(arr[i])); row.style.cursor="hand"; row.onclick=function s()...{//onclick事件的触发 document.all.result.value=this.innerText;//对象result的value为row的innerText,注意this对象 }; }