代码编辑器:
x
1
E-mail: <input type="email" id="myEmail" value="johndoe@example.com">
2
<p>点击按钮显示 email 字段的邮件地址</p>
3
<button onclick="myFunction()">点我</button>
4
<p id="demo"></p>
5
<script>
6
function myFunction() {
7
var x = document.getElementById("myEmail").value;
8
document.getElementById("demo").innerHTML = x;
9
}
10
</script>
11