webveuje/teaching/林锦绣/form.html
2021-06-03 10:52:41 +08:00

22 lines
746 B
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text" value="">
<script>
// 1.选中目标元素 2. 取出value的值
// 1.选中目标元素 除了通过id来取之外其他取出来的值都是一些集合数组
// id具有唯一性 所以通过id来取的结果 就是单个元素
var info=document.getElementsByTagName("input")
console.log(info)
document.write("值为"+info[0].value)
alert(info[0].value)
prompt("fdgf")
</script>
</body>
</html>