如何在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>热门推荐
10 喝酒祝福语大全简短新颖
11 烟酒店开业祝福语简短
12 侄儿高考试祝福语简短
13 同事孩子上学祝福语简短
14 女孩生日祝福语简短的话
15 元旦感恩祝福语简短大全
16 女神节医生祝福语简短
17 默克尔离职祝福语简短
18 接到英文简短老师祝福语