|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 wp231957 于 2020-3-22 18:21 编辑
//本次修改:遍历数组 我居然还在用for循环 实在是没学到位啊
- <!doctype html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>字体反爬示例</title>
- <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
- <style>
- /*字体反爬中的一种写法,暂定为固定写法吧*/
- /*CSS中注释写法,需要记住*/
- @font-face {
- font-family: stonefont;
- src:url('wp.woff') format('woff');
- }
- .stonefont {
- font-family: stonefont;
- }
- </style>
- </head>
- <body>
- <div id="test"></div>
- <script>
- var fontw=new Array();
- //这些映射如何发现呢,我是WOFF-->TTF 然后用在线查看工具例如百度字体 就能看到了
- fontw=["\u{ee76}","\u{f57b}","\u{e7df}","\u{f19a}","\u{f593}","\u{ea16}","\u{e339}","\u{e9c7}","\u{efd4}","\u{e624}"];
- $.each(fontw,function(index,value){
- //动态增加10个h3标签
- $("#test").append("<h3 class='stonefont'></h3>");
- });
-
- $(".stonefont").each(function(index,value){
- /*
- //为每个标签文本属性赋值,当然这里写的文本
- //是浏览器端能看见的正常的值,开发者工具中
- //看到的是乱码了
- */
- $(this).text(fontw[index]);
- });
- </script>
- </body>
- </html>
复制代码
|
|