随笔分类 -  HTML

解决中文在 html 文件中乱码
摘要:index.html <!DOCTYPE html> <html> <head> <!-- 定义网页编码格式 --> <meta charset="UTF-8" /> </head> <body> <script> alert("右究"); </script> </body> </html> 阅读全文

posted @ 2021-09-10 10:43 aisowe 阅读(97) 评论(0) 推荐(0) 编辑

解决因`script`前置而造成的操作 DOM 报错
摘要:index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script> document.addEventListener("DOMContentLoaded", function () { console.log(doc 阅读全文

posted @ 2021-09-10 10:42 aisowe 阅读(77) 评论(0) 推荐(0) 编辑

减轻被恶意网站修改父窗口 URL 的风险
摘要:方法1:给 a 标签添加 rel 属性 <a href="https://an.evil.site" target="_blank" rel="noopener">恶意网站</a> 方法2:打开子窗口时将子窗口的 opener 设置为 null const newWin = window.open( 阅读全文

posted @ 2021-09-10 10:04 aisowe 阅读(42) 评论(0) 推荐(0) 编辑

根据页面本身的协议来决定加载脚本时使用的协议
摘要:index.html <sript src="//example.js"></sript> 阅读全文

posted @ 2021-09-10 09:38 aisowe 阅读(28) 评论(0) 推荐(0) 编辑

防止攻击者篡改外部脚本
摘要:index.html <!-- integrity 属性为该外部脚本写入哈希签名,用于验证脚本一致性 --> <script src="./xxx.js" integrity="****"></script> 阅读全文

posted @ 2021-09-10 09:35 aisowe 阅读(35) 评论(0) 推荐(0) 编辑

js 触发打印操作
摘要:index.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> </head> <body> <button onclick="clickHandler()">print</button> <script> function cli 阅读全文

posted @ 2021-09-09 10:33 aisowe 阅读(169) 评论(0) 推荐(0) 编辑

保留 a 标签链接样式的同时,让页面不发生跳转
摘要:index.html <a href="javascript:void(0)" onclick="alert('右究')">点击</a> 阅读全文

posted @ 2021-09-09 10:22 aisowe 阅读(30) 评论(0) 推荐(0) 编辑

怎样理解 DOCTYPE 声明
摘要:1. HTML 4.01 Strict 2. HTML 4.01 Transitional 3. HTML 4.01 Frameset 4. HTML 5 阅读全文

posted @ 2019-08-31 11:27 aisowe 阅读(163) 评论(0) 推荐(0) 编辑

怎样修改输入框 placehoder 提示文本的颜色?
摘要:1. 在这个问题上, 不同浏览器的设置方法有所差异, 可以写成下面这种形式. 详情见: https://stackoverflow.com/questions/2610497/change-an-html5-inputs-placeholder-color-with-css 阅读全文

posted @ 2019-08-28 21:22 aisowe 阅读(456) 评论(0) 推荐(0) 编辑

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示