转码
kadxls
这个作者很懒,什么都没留下…
展开
-
HTML地址栏(hash)获取并转码(个人菜鸟笔记)
decodeURIComponent(document.location.href)decodeURIComponent 为转码document.location.href 为当前hash原创 2016-05-20 13:22:04 · 1845 阅读 · 0 评论 -
JS 计算字符长度 包括中英文和标点
计算的实际应该是字符的宽度,Unicode换算出后中文算两个宽度// Get string widthfunction getStringWidth(val) { let len = 0; for (let i = 0; i < val.length; i++) { let length = val.charCodeAt(i); if( length >...原创 2019-05-20 14:44:53 · 1973 阅读 · 0 评论