如何在JavaScript中使用document.head?
使用JavaScript中的document.head属性获取文档<head>标记的ID。您可以尝试运行以下代码以在JavaScript中实现document.head属性-
<!DOCTYPE html><html>
<head id = "myid">
<title>JavaScript Example</title>
</head>
<body>
<h1>Employee Information</h1>
<form>
Name: <input type = "text" name = "name" value = "Amit"><br>
Subject: <input type = "text" name = "sub" value = "Java">
</form>
<script>
var a = document.head.id;
document.write("<br>Head element id? "+a);
</script>
</body>
</html>
以上是 如何在JavaScript中使用document.head? 的全部内容, 来源链接: utcz.com/z/326676.html