js 滚动页面,元素粘顶效果 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021 javascript #js #javascript
js 的常用调试:弹框 和 console 弹框: alert() confirm() 3.prompt() console对象: 在上图的console对象中比较常用的就是: console.log() console.info() console.error console.warn() javascript #js #javascript
js 监听屏幕旋转变化(横屏/竖屏) 123456789101112131415<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><body> <script&g javascript #js #javascript
js 禁止修改变量:冻结对象或数组 Object.freeze() Object.freeze()的使用 数组: 123456789101112131415161718192021<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>Object.freeze</title> </head> & javascript #js #javascript
js 禁止修改变量:冻结已有对象的属性:Object.defineProperty() Object.defineProperty()的使用 123456789101112131415161718192021222324252627<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title></title> </head&g javascript #js #javascript
js 禁止页面打开查看源码 能够查看页面源码的无非就是右击的保存、检查、查看页面源代码和相应的快捷键(Ctrl+S、Ctrl+Shift+I 、Shift+F10和Ctrl+U)F12 123456789101112131415161718192021222324252627282930313233343536373839404142<!DOCTYPE html><html lang="en&qu javascript #js #javascript
js 获取html dom元素的方式 1234567891011121314151617181920212223242526272829303132333435363738394041424344<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name=&q javascript #js #javascript
js 获取元素在页面中的位置 1234567891011121314151617181920212223242526272829303132333435363738<!DOCTYPE html><html><head> <meta charset="utf-8"></head><style> div{ width: 100 javascript #js #javascript
js 获取元素属性的值 || 设置元素属性的值 || 移除属性 || 增删改查类名 123456789101112131415161718192021222324// 1. 获取元素的属性值: element.getAttribute("属性");// 2. 设置元素的属性值: element.setAttribute("属性","值");// 3. 移除元素的属性: element.removeAttribute javascript #js #javascript
js 获取汉字拼音的首字母 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021 javascript #js #javascript