弹来弹去跑马灯!

JS 生成二维码

1
JS 生成二维码:
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta name="referrer" content="always" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <meta name="renderer" content="webkit" />
  <meta name="keywords" content="JS 生成二维码" />
  <meta name="description" content="JS 生成二维码" />
  <title>JS 生成二维码  -by wgscd</title>
</head>
 
<body>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
  
<div id="output"></div>
<script>
    // 转中文内容UTF-8
    function toUtf8(str) {
        var out, i, len, c;
        out = "";
        len = str.length;
        for (i = 0; i < len; i++) {
            c = str.charCodeAt(i);
            if ((c >= 0x0001) && (c <= 0x007F)) {
                out += str.charAt(i);
            } else if (c > 0x07FF) {
                out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
                out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
                out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
            } else {
                out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
                out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
            }
        }
        return out;
    }
    // 设置二维码参数
    function make() {
        $('#output').qrcode({
            render: "table", // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
            width: 200, // 宽度
            height: 200, // 高度
            background: "#FFFFFF", // 背景颜色
            foreground: "#000000", // 前景颜色
            correctLevel: 0, // 纠错等级
            src: 'images/logo4.png',
            text: 'http://www.baidu.com/888'
            //text: toUtf8("二维码生成前端插件:jquery.qrcode.min.js") // 任意内容
        });
    }
    make();
</script>
 
  <center>
    <p>JS 生成二维码</p>
  </center>
</body>
</html>

  

posted @   wgscd  阅读(80)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)
历史上的今天:
2023-07-28 wpf ScrollViewer 滚动动画
2021-07-28 WPF 设置Button的content为多行模式
2016-07-28 Advanced Find and Replace(文件内容搜索替换工具)v7.8.1简体中文破解版
点击右上角即可分享
微信分享提示