摘要: const fs = require('fs') // __dirname 表示当前文件所处的目录 // console.log(__dirname) fs.readFile(__dirname + '/files/1.txt', 'utf8', function(err, dataStr) { i 阅读全文
posted @ 2022-05-27 15:46 hi123hi159 阅读(30) 评论(0) 推荐(0)
摘要: // 1. 导入 fs 模块 const fs = require('fs') // 2. 调用 fs.readFile() 读取文件的内容 fs.readFile('../素材/成绩.txt', 'utf8', function(err, dataStr) { // 3. 判断是否读取成功 if 阅读全文
posted @ 2022-05-27 15:25 hi123hi159 阅读(37) 评论(0) 推荐(0)
摘要: // 1. 导入 fs 文件系统模块 const fs = require('fs') // 2. 调用 fs.writeFile() 方法,写入文件的内容 // 参数1:表示文件的存放路径 // 参数2:表示要写入的内容 // 参数3:回调函数 fs.writeFile('./files/3.tx 阅读全文
posted @ 2022-05-27 14:43 hi123hi159 阅读(58) 评论(0) 推荐(0)
摘要: const fs = require('fs') fs.readFile('./files/11.txt', 'utf8', function(err, dataStr) { if (err) { return console.log('读取文件失败!' + err.message) } conso 阅读全文
posted @ 2022-05-27 14:30 hi123hi159 阅读(89) 评论(0) 推荐(0)
摘要: // 1. 导入 fs 模块,来操作文件 const fs = require('fs') // 2. 调用 fs.readFile() 方法读取文件 // 参数1:读取文件的存放路径 // 参数2:读取文件时候采用的编码格式,一般默认指定 utf8 // 参数3:回调函数,拿到读取失败和成功的结果 阅读全文
posted @ 2022-05-27 14:23 hi123hi159 阅读(514) 评论(0) 推荐(0)
摘要: <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title></title> <style> .login-header { width: 100%; text-align: center; height: 30px; 阅读全文
posted @ 2022-05-27 11:36 hi123hi159 阅读(24) 评论(0) 推荐(0)
摘要: // offset 系列 var father = document.querySelector('.father'); var son = document.querySelector('.son'); // 1.可以得到元素的偏移 位置 返回的不带单位的数值 console.log(father 阅读全文
posted @ 2022-05-27 09:42 hi123hi159 阅读(78) 评论(0) 推荐(0)
摘要: //前进一个页面 history.go(1); //后退一个页面 history.go(-1); 阅读全文
posted @ 2022-05-27 09:26 hi123hi159 阅读(86) 评论(0) 推荐(0)
摘要: if ((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebO 阅读全文
posted @ 2022-05-27 09:15 hi123hi159 阅读(52) 评论(0) 推荐(0)
摘要: console.log(location.search); // ?uname=andy // 1.先去掉? substr('起始的位置',截取几个字符); var params = location.search.substr(1); // uname=andy console.log(param 阅读全文
posted @ 2022-05-27 08:44 hi123hi159 阅读(48) 评论(0) 推荐(0)
摘要: var btn = document.querySelector('button'); var div = document.querySelector('div'); btn.addEventListener('click', function() { // console.log(locatio 阅读全文
posted @ 2022-05-27 08:32 hi123hi159 阅读(142) 评论(0) 推荐(0)