<div class="r_page_indent_title">会员推广</div> <div style="float: left;margin-left: 10px"> <textarea cols="70" rows="10">{$userExtendLink}</textarea> <br/><br/> <button class="fenxiang">分享</button> <button class="fuzhi">复制</button> </div> <div style="float: left;margin-left: 20px"> <img src="<php>echo \Media\Model\Qrode::createPng($userExtendLink, $jm);</php>" /> <br/><br/> <button class="xiazai">下载二维码</button> </div>
https://github.com/zeroclipboard/zeroclipboard
<script type="text/javascript" src="__JS__/ZeroClipboard/ZeroClipboard.min.js"></script> <script type="text/javascript"> $('.fenxiang').click(function(){ var url = encodeURIComponent($(this).prevAll('textarea').eq(0).val()); var title = url; window.open('http://s.share.baidu.com/mshare?click=1&url='+url+'&uid=0&to=mshare&type=text&pic=&title='+title); }); $(".xiazai").click(function(){ var src = $(this).prevAll('img').eq(0).attr('src'); location.href = '/media/user/dz?src='+src; }); var client = new ZeroClipboard( $(".fuzhi") ); client.on( 'ready', function(event) { client.on( 'copy', function(event) { var url = $(event.target).prevAll('textarea').eq(0).val(); event.clipboardData.setData('text/plain', url); } ); client.on( 'aftercopy', function(event) { alert('复制成功'); } ); } ); client.on( 'error', function(event) { alert('复制失败,请按CTRL+C复制'); ZeroClipboard.destroy(); } ); </script>