如果你非要點擊時添加上去,就這樣把:
td.onmousedown = function(){
//當鼠標點擊一個關聯數據時,自動在輸入框添加數據
document.getElementById("keyword").value =this.innerText;
};
td.onmousedown = function(){
//當鼠標點擊一個關聯數據時,自動在輸入框添加數據
document.getElementById("keyword").value =this.innerText;
};
2016-11-05
還有一個鼠標放到對應的td上就把對應的值加到input里面的方法如下:
td.onmouseover = function(){
this.className = 'mouseOver';
if(td.innerText != null)
document.getElementById("keyword").value =this.innerText;
}
td.onmouseover = function(){
this.className = 'mouseOver';
if(td.innerText != null)
document.getElementById("keyword").value =this.innerText;
}
2016-11-05