e před 1 rokem
rodič
revize
56a4791968

+ 19 - 0
js/js初阶/1.引用js.html

@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <!-- <script defer src="./1.引用js.js"></script> -->
+</head>
+<body>
+    哈哈哈哈
+    <!-- <script>
+        alert("弹出")
+    </script> -->
+    <!-- 
+        src 属性:解决跨域问题 同源策略
+     -->
+    <!-- <script  src="./1.引用js.js"></script> -->
+</body>
+</html>

+ 2 - 0
js/js初阶/1.引用js.js

@@ -0,0 +1,2 @@
+// document.write("哈哈哈")
+alert("lll")

+ 36 - 0
js/js初阶/2.变量.html

@@ -0,0 +1,36 @@
+<!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>
+      // 注释 :单行注释 多行注释
+      // 单行注释
+      /**
+       * @author Lucy
+       * @date 2024.05.30
+       */
+      /**
+       * 变量命名:
+       * 1.变量必须以字母开头
+       * 2.变量名字组成:字母,下划线_,数字和$(美元符号)
+       * 3.变量严格区分大小写
+       * 4.变量不能以关键字命名
+       */
+      // 定义变量 字面量
+      // 1、var 声明变量
+      // var a;
+      // var 名字;
+      // 打印 console.log()
+      // 变量提升
+      console.log(a, "现在打印的是a的值");
+      // 2.变量赋值
+      // a = 1;
+      var a = 12;
+      console.log(a);
+    </script>
+  </body>
+</html>

+ 81 - 0
js/js初阶/3.变量的运算.html

@@ -0,0 +1,81 @@
+<!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>
+      /**
+       * 算术运算:+ - * / %
+       */
+      var a = 1;
+      var b = 2;
+      var c = 5;
+      var d = 10;
+      var e = 11;
+      /**
+       * js类型:
+       * number数字
+       * string 字符串
+       * boolean 布尔: true 1 / false 0
+       * null 空
+       * undefined 未定义
+       * */
+      //   console.log(a + b);
+      //   console.log(a + "1"); //number + string 拼接
+      //   console.log(a + true);
+      //   console.log(a + null);
+      //   console.log(a + undefined); // NaN 非法数字
+
+      //   console.log(a - b);
+      //   console.log(a - "10"); //number - string 正常运算
+      //   console.log(a - true);
+      //   console.log(a - null);
+      //   console.log(a - undefined); // NaN 非法数字
+
+      //   console.log(a * b);
+      //   console.log(a * "10"); //number * string 正常运算
+      //   console.log(a * true);
+      //   console.log(a * null); // null 作为0
+      //   console.log(a * undefined); // NaN 非法数字
+
+      //   console.log(a / b);
+      //   console.log(a / "10"); //number / string 正常运算
+      //   console.log(a / true);
+      //   console.log(a / null); // Infinity 无穷
+      //   console.log(a / undefined); // NaN 非法数字
+      //   console.log(e % c);
+      //   console.log(22 % "10"); //number % string 正常运算
+      //   console.log(a % true);
+      //   console.log(a % null); // NaN 非法数字
+      //   console.log(a % undefined); // NaN 非法数字
+      /**
+       * 关系运算 > < = >= <=
+       */
+      /**
+       * 区别
+       * = 赋值
+       * == 强制转换 类型转换
+       * === 全等 类型与数值必须相同才相等
+       * 
+      */
+     console.log(a == true);
+     console.log(a === 1);
+      /**
+       * 逻辑运算符
+       * && 和 都为真 才为真
+       * || 或 一方为真 则为真
+       * ! 非
+       */
+    //   console.log(a<4 && a < 10);
+    //   console.log(a>4 || a > 10);
+    //   console.log(a != 0)
+    // alert("111") 警告框
+    // window.alert("111")
+    // confirm("1112")  确认框
+    // prompt("请输入内容",'哈哈哈哈') 输入框
+    </script>
+  </body>
+</html>

+ 19 - 0
js/js初阶/4.练习.html

@@ -0,0 +1,19 @@
+<!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>
+      /**
+        * 
+        * 1.请输入年龄,我们计算他活了多少秒
+        * 2.使用window.prompt可以弹出包含输入框的窗口,用户输入的内容将是此函数的返回值
+        * 年份  判断 是不是闰年 如果是 返回一个 我是闰年  如果不是 返回一个  我不是闰年
+        * 年份是4的倍数,且不是100的倍数的
+       */
+    </script>
+  </body>
+</html>