qrcode创建二维码图片

news/2024/7/10 22:40:40 标签: Jquery, qrcode

1、引入jquery.min.js和qrcode.js
2、声明创建二维码的容器的DIV
3、调用qrcode.js创建方法

<!DOCTYPE html>
<html>
	<head>
		<title>预览</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
		<script src="../../js/jquery.min.js"></script>
		<script src="../../js/qrcode.js"></script> 
		<style type="text/css">
			body {
				background: #fff;
				margin: 0px;
				padding: 0px;
			}
			h2{
				text-align: center;
			}
			p{
				font-size: 15px;
				font-family: "微软雅黑";
			}
		</style>
		
	</head>
	<body>

		<div id="qrcode" style="margin-left: 30px;"></div> 

	
	</body>
<script type="text/javascript">
var shareUrl='123456789';

var qrcode = new QRCode(document.getElementById("qrcode"), {
	width : 100,
	height : 100
});
function makeCode () {		
	qrcode.makeCode(shareUrl);
}
makeCode();
</script>
</html>

创建QRCode中可传构造参数:
width : 256, //宽度
height : 256,//高度
typeNumber : 4,//计算模式 ,一般不用
colorDark : “#000000”,//图点色
colorLight : “#ffffff”,//背景色
correctLevel : QRErrorCorrectLevel.H//错误级别[L|M|Q|H]

附件地址:
JQuery

qrcode


http://www.niftyadmin.cn/n/1527352.html

相关文章

红包——二倍均值和线段切割

每个人至少抢到一分钱。 所有人抢到金额之和等于红包金额&#xff0c;不能超过&#xff0c;也不能少于。 要保证所有人抢到金额的几率相等。 1.二倍均值 // 发红包算法&#xff0c;金额参数以分为单位public static List<Integer> divideRedPackage(Integer totalAmount…

hibernate配置非主键关联

未查找到one-to-one的非主键配置&#xff0c;记录下many-to-one的非主键配置&#xff0c; 配置如下&#xff1a;<many-to-one name"profiteAccount" class"com.chinarb.entity.ProfiteAccount" property-ref"ownerId" fetch"select&qu…

HttpURLConnection文件下载

基本方法和类关系&#xff1a; java.net 类 HttpURLConnection java.lang.Object 继承者 java.net.URLConnection 继承者 java.net.HttpURLConnection 直接已知子类&#xff1a; HttpsURLConnection public abstract class HttpURLConnection extends URLConnection 支持 HT…

@Transactional自调用失效问题

Transactional自调用失效问题 Transactional在某些场景下会失效&#xff0c;我们把传播行为修改为REQUIRESNEW&#xff0c;也就是每次调用产生新的事务 Transactional(isolation Isolaton.READCOMMITTED, propagation Propagation.REQUIRED) public int insertUsers (List…

WebSecurityConfigurerAdapter中的configuer

configuer方法讲解 // WebSecurityConfigurerAdapter默认设定访问权限和登录方式 protected void configure(HttpSecurity http) throws Exception { logger.debug (”Using default configure(HttpSecurity). "If subclassed thwill potentially""overrdesub…

接受参数转链接

问题描述&#xff1a;两边业务对接&#xff0c;下游传参数&#xff0c;这边返回一个JSON数据&#xff0c;其中有一个键值对是超链接&#xff0c;现在上游渠道返回的是HTML文本内容&#xff0c;需要把文本转成可以打开的超链接共下游使用。 方法一&#xff1a;接受下游数据&…

Spring Security登录配置文件讲解

spring security的登录文件一般会自己重新定义&#xff0c;重新里面的方法 configure&#xff0c;设置方法参数属性&#xff0c;达到重新自定意拦截登录以及重定向方法的作用。 方法参数为 HttpSecurity http //设置表单提交http.formLogin().//重新定义表单的username接受值的…

spring security配置文件中的and()

在使用 spring security的过程中需要使用继承WebSecurityConfigurerAdapter类重写里面的configure(HttpSecurity httpSecurity)方法&#xff0c;配置里面的参数用于达到自定义拦截请求的目的。 在看到and()方法的时候进入源码public abstract class SecurityConfigurerAdapter&…