<input type="text" class="form-control" id="name" value="" >
<button type="button" class="btn btn-info" value="abc" onclick="getValue(this.value)">abc</button>
1、方式一
function getValue(val){
document.getElementById("name").setAttribute("value",val);
}
2、方式二
function getValue(val){
document.getElementById("name").value=val;
}