e 2 viikkoa sitten
vanhempi
commit
89567216ad
3 muutettua tiedostoa jossa 75 lisäystä ja 0 poistoa
  1. 21 0
      3.js初级/BOM/6.location.html
  2. 26 0
      3.js初级/BOM/7.Navigator.html
  3. 28 0
      3.js初级/BOM/8.补充.html

+ 21 - 0
3.js初级/BOM/6.location.html

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <script>
+        //hash 设置或返回从井号 (#) 开始的 URL(锚)
+        //host 设置或返回主机名和当前 URL 的端口号
+        //hostname 设置或返回当前 URL 的主机名
+        //href 设置或返回完整的 URL
+        //pathname 设置或返回当前 URL 的路径部分
+        //port 设置或返回当前 URL 的端口号
+        //protocol 设置或返回当前 URL 的协议
+        //search 设置或返回从问号 (?) 开始的 URL(查询部分)
+        console.log(location.port)
+    </script>
+</body>
+</html>

+ 26 - 0
3.js初级/BOM/7.Navigator.html

@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <!-- 
+        appCodeName 返回浏览器的代码名
+        appName 返回浏览器的名称
+        appVersion 返回浏览器的平台和版本信息
+        browserLanguage 返回当前浏览器的语言
+        cookieEnabled 返回指明浏览器中是否启用 cookie 的布尔值
+        cpuClass 返回浏览器系统的 CPU 等级
+        onLine 返回指明系统是否处于脱机模式的布尔值
+        platform 返回运行浏览器的操作系统平台
+        systemLanguage 返回 OS 使用的默认语言
+        userAgent 返回由客户机发送服务器的 user-agent 头部的值
+        userLanguage 返回 OS 的自然语言设置
+     -->
+    <script>
+        console.log(navigator)
+    </script>
+</body>
+</html>

+ 28 - 0
3.js初级/BOM/8.补充.html

@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <span>1</span>
+    <span>2</span>
+    <span>3</span>
+    <span>4</span>
+    <span>5</span>
+    <button id="btn1">
+        添加
+    </button>
+    <script>
+        // 获取同一元素所有标签
+        var spans = document.querySelectorAll('span');
+        console.log(spans)
+        var btn1 = document.getElementById("btn1");
+        btn1.onclick = function() {
+            // 往节点内添加内容
+            spans[1].innerText ='我的'
+        }
+    </script>
+</body>
+</html>