一、知识要点
1、属性控制 2、点击事件提取
二、源码参考
代码语言:javascript复制<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript">
window.onload = function() {
var btn1 = document.getElementById('btn1');
var txt1 = document.getElementById('txt1');
btn1.onclick = function() {
txt1.value = "dfdfdfdfdf";
}
}
</script>
</head>
<body>
<input type="button" name="btn1" id="btn1" value="点击" />
<input type="text" name="txt1" id="txt1" value="" />
</body>
</html>
三、运行效果
image.png