基本信息
源码名称:jquery生成当前页面二维码功能分享微信
源码大小:0.03M
文件格式:.rar
开发语言:js
更新时间:2016-03-30
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

下载直接使用

用javascript 将当前页面网址url 生成二维码

<html>
<head>
 <base href="<%=basePath%>">

 <title>二维码</title>

<meta http-equiv="pragma"content="no-cache">

<meta http-equiv="cache-control"content="no-cache">

<meta http-equiv="expires"content="0"> 

<meta http-equiv="keywords"content="keyword1,keyword2,keyword3">

<meta http-equiv="description"content="二维码">

<!--

<link rel="stylesheet"type="text/css"href="styles.css">

-->

<script type="text/javascript"src="js/jquery.js"></script>

<script type="text/javascript"src="js/qrcode.js"></script>

<script type="text/javascript"src="js/jquery.qrcode.js"></script>
<style>  
  #fd  
  {   
    width:120px;  
    height:120px;  
    background:white;   
    border: 1px solid black;  
    margin-top:2px;  
    margin-left:2px;  
    float:left;  
    overflow-y:auto;  
    overflow-x:hidden;  
    position:absolute;  
    left:400px;  
   /*  bottom:260px; */
    top:90px;  
    cursor:move;  
    float:left;  
    
  }  
  </style>  
</head>

<body>
 <br>


<div id="fd" style="display:none;filter:alpha(opacity=100);opacity:1;color:#849BCA;" >  
			 	<div id="erweima" style="width: 120px; float: left;padding-left: 5px;padding-top:5px;"></div>
        		<div style="float: right; padding-top: 50px; padding-right: 10px;">
        			&nbsp;&nbsp;&nbsp;<span>分&nbsp;&nbsp;&nbsp;&nbsp;享&nbsp;&nbsp;&nbsp;&nbsp;到</span> </br>
        			<span>微&nbsp;&nbsp;信&nbsp;&nbsp;朋&nbsp;&nbsp;友&nbsp;&nbsp;圈</span>
        		</div>
    		</div>  
<div style="padding-top:200px;padding-left:500px;">
	<span>
		<input type="button" id="btn" value="二维码" onclick = "show('fd');" />  
	</span>
</div>

<script type="text/javascript">  
    var prox;  
    var proy;  
    var proxc;  
    var proyc;  
    
    
    /*--打开--*/  
    function show(id)  
    {  
    	
    	
        btn.onclick = function(){closeed('fd');}  
        btn.value = "二维码";  
        clearInterval(prox);  
        clearInterval(proy);   
        clearInterval(proxc);  
        clearInterval(proyc);  
        var o = document.getElementById(id);  
        o.style.display = "block";  
        o.style.width = "1px";  
        o.style.height = "1px";   
        prox = setInterval(function(){openx(o,270)},0);  
        /*--生成二维码 --*/
        jQuery('#erweima').qrcode({
        	width:120,
        	height:120,
			render : "canvas",
			text : document.URL
		});
		
    	/*--生成二维码 --*/
    }     
    /*--打开x--*/  
    function openx(o,x)  
    {  
        var cx = parseInt(o.style.width);  
       
        if(cx < x)  
        {  
            o.style.width = (cx   Math.ceil((x-cx)/5))  "px";  
        }  
        else  
        {  
            clearInterval(prox);  
            proy = setInterval(function(){openy(o,135)},0);  
        }  
        
    }  
    /*--打开y--*/   
    function openy(o,y)  
    {  
        var cy = parseInt(o.style.height);  
        if(cy < y)  
        {  
            o.style.height = (cy   Math.ceil((y-cy)/5))  "px";  
        }  
        else  
        {  
            clearInterval(proy);              
        }  
    }     
    /*--关闭--*/  
    function closeed(id)  
    {  
        btn.onclick = function(){show('fd');}  
        btn.value = "二维码";  
      
        clearInterval(prox);  
        clearInterval(proy);  
        clearInterval(proxc);  
        clearInterval(proyc);         
        var o = document.getElementById(id);  
        if(o.style.display == "block")  
        {  
            proyc = setInterval(function(){closey(o)},0);            
        }         
    }     
    /*--关闭y--*/  
    function closey(o)  
    {     
        var cy = parseInt(o.style.height);  
        if(cy > 0)  
        {  
            o.style.height = (cy - Math.ceil(cy/5))  "px";  
        }  
        else  
        {  
            clearInterval(proyc);                 
            proxc = setInterval(function(){closex(o)},0);  
        }  
    }     
    /*--关闭x--*/  
    function closex(o)  
    {  
        var cx = parseInt(o.style.width);  
        if(cx > 0)  
        {  
            o.style.width = (cx - Math.ceil(cx/5))  "px";  
        }  
        else  
        {  
            clearInterval(proxc);  
            o.style.display = "none";  
            $("#erweima").empty();
           
        }  
    }     
    /*-------------------------鼠标拖动---------------------*/    
    /* var od = document.getElementById("fd");   
    var dx,dy,mx,my,mouseD;  
    var odrag;  
    var isIE = document.all ? true : false;  
    document.onmousedown = function(e)  
    {  
        var e = e ? e : event;  
        if(e.button == (document.all ? 1 : 0))  
        {  
            mouseD = true;            
        }  
    }  
    document.onmouseup = function()  
    {  
        mouseD = false;  
        odrag = "";  
        if(isIE)  
        {  
            od.releaseCapture();  
            od.filters.alpha.opacity = 100;  
        }  
        else  
        {  
            window.releaseEvents(od.MOUSEMOVE);  
            od.style.opacity = 1;  
        }         
    }  
    od.onmousedown = function(e)  
    {  
        odrag = this;  
        var e = e ? e : event;  
        if(e.button == (document.all ? 1 : 0))  
        {  
            mx = e.clientX;  
            my = e.clientY;  
            od.style.left = od.offsetLeft   "px";  
            od.style.top = od.offsetTop   "px";  
            if(isIE)  
            {  
                od.setCapture();                  
                od.filters.alpha.opacity = 50;  
            }  
            else  
            {  
                window.captureEvents(Event.mousemove);  
                od.style.opacity = 0.5;  
            }  
        }   
    }  
    document.onmousemove = function(e)  
    {  
        var e = e ? e : event;        
        if(mouseD==true && odrag)  
        {         
            var mrx = e.clientX - mx;  
            var mry = e.clientY - my;     
            od.style.left = parseInt(od.style.left)  mrx   "px";  
            od.style.top = parseInt(od.style.top)   mry   "px";           
            mx = e.clientX;  
            my = e.clientY;   
        }  
    }   */
    /*处理中文*/
    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;    
} 
    </script>  
</body>
</html>