7点击按钮修改所有文本框的内容
<input type="button" name="" id="btn7" value="来啊 ,点我啊~" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<input type="text" name="" id="" value="" /><br>
<script type="text/javascript">
//根据id获取按钮,为按钮注册点击事件,添加事件处理函数
document.getElementById("btn7").onclick = function() {
var inpObj = document.getElementsByTagName("input");
for (var i = 0; i < inpObj.length; i++) {
if (inpObj[i].type == "text") {
inpObj[i].value = "点了又没怎样~";
}
}
}
</script>