zsydgithub 2 年之前
父節點
當前提交
7093bd8c0e
共有 5 個文件被更改,包括 103 次插入0 次删除
  1. 5 0
      5_Dom/1_基础.html
  2. 19 0
      5_Dom/2_弹出框.html
  3. 20 0
      5_Dom/3_history.html
  4. 40 0
      5_Dom/4_location.html
  5. 19 0
      5_Dom/test.html

+ 5 - 0
5_Dom/1_基础.html

@@ -101,6 +101,11 @@
       },100);
     }
 
+    console.log(Math.random()) //0-1随机数
+
+    setInterval(function(){
+      console.log(Math.floor(Math.random()*100))
+    },1000)
     
   </script>
 </body>

+ 19 - 0
5_Dom/2_弹出框.html

@@ -0,0 +1,19 @@
+<!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>
+  <script>
+    // alert(str)—— 弹出消息对话框(对话框中有一个“确定”按钮)
+    // confirm(str)—— 弹出消息对话框(对话框中包含一个“确定”按钮与“取消”按钮)
+    window.confirm('hahaha')
+    // prompt(str,defaultValue)——弹出消息对话框(对话框中包含一个“确定”按钮、“取消”按钮与一个文本输入框),
+    // 由于各个浏览器实现的不同,若没有第二个参数(文本框中的默认值)时也最好提供一个空字符串
+
+  </script>
+</body>
+</html>

+ 20 - 0
5_Dom/3_history.html

@@ -0,0 +1,20 @@
+<!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>
+  <h2>我是首页</h2>
+  <a href="test.html">跳转</a>
+  <button id="btn1">点击下一页</button>
+  <script>
+    var btn1 = document.getElementById('btn1')
+    btn1.onclick = function(){
+      history.forward()
+    }
+  </script>
+</body>
+</html>

+ 40 - 0
5_Dom/4_location.html

@@ -0,0 +1,40 @@
+<!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>
+  <script>
+    // Location 对象的属性
+
+    // hash 设置或返回从井号 (#) 开始的 URL(锚)
+    // host 设置或返回主机名和当前 URL 的端口号
+    // hostname 设置或返回当前 URL 的主机名
+    // href 设置或返回完整的 URL
+    // pathname 设置或返回当前 URL 的路径部分
+    // port 设置或返回当前 URL 的端口号
+    // protocol 设置或返回当前 URL 的协议
+    // search 设置或返回从问号 (?) 开始的 URL(查询部分)
+
+
+    // Navigator 对象的属性
+
+    // appCodeName 返回浏览器的代码名
+    // appName 返回浏览器的名称
+    // appVersion 返回浏览器的平台和版本信息
+    // browserLanguage 返回当前浏览器的语言
+    // cookieEnabled 返回指明浏览器中是否启用 cookie 的布尔值
+    // cpuClass 返回浏览器系统的 CPU 等级
+    // onLine 返回指明系统是否处于脱机模式的布尔值
+    // platform 返回运行浏览器的操作系统平台
+    // systemLanguage 返回 OS 使用的默认语言
+    // userAgent 返回由客户机发送服务器的 user-agent 头部的值
+    // userLanguage 返回 OS 的自然语言设置
+
+
+  </script>
+</body>
+</html>

+ 19 - 0
5_Dom/test.html

@@ -0,0 +1,19 @@
+<!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>
+  <h2>我是子页面</h2>
+  <button id="btn1">返回首页</button>
+  <script>
+    var btn1 = document.getElementById('btn1')
+    btn1.onclick = function(){
+      history.back()
+    }
+  </script>
+</body>
+</html>