發(fā)布時(shí)間:2017/7/30 15:06:41 關(guān)注:2065
不少客戶(hù)反饋,很多軟件采集手機號碼郵箱等,我怎么才能做到真正需要的人能聯(lián)系到我,不想管人員不能看到我的聯(lián)系方式呢,如何才能做到宣傳的同時(shí),信息實(shí)現在搜索引擎隱藏不被過(guò)度使用。
想到實(shí)現這種問(wèn)題我們可以采用聯(lián)系電話(huà)、郵箱等采取生成圖片的方式,當然也可以采用直接把聯(lián)系方式直接做到圖片上,相比較而言程序生成的聯(lián)系方式更具備靈活性。
我們今天主要討論采用HTML5 canvas繪圖對象來(lái)實(shí)現該功能,聯(lián)系方式使用JS的unicode加密,直接生成,修改聯(lián)系方式更簡(jiǎn)單。
<!DOCTYPE html> <html> <header> <script type="text/javascript" src="http://www.qmsxw.com/js/jquery-1.12.0.min.js"></script> </header> <style> .box>img{width: 100%;height: 100%;} </style> <body> <div class="box" style="border: 1px solid red;width: 500px;height: 200px;"></div> <canvas id="myCanvas" width="300" height="150" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag. </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.font="20px Georgia"; ctx.fillText("Hello World!",10,50); ctx.font="30px Verdana"; // Create gradient var gradient=ctx.createLinearGradient(0,0,c.width,0); gradient.addColorStop("0","magenta"); gradient.addColorStop("0.5","blue"); gradient.addColorStop("1.0","red"); // Fill with gradient ctx.fillStyle=gradient; ctx.fillText("\u0031\u0033\u0035\u0036\u0032\u0036\u0031\u0031\u0034\u0039\u0039",10,90); ctx.fillText("hahahahaha",10,120); var img = convertCanvasToImage(c); $('.box').append(img); console.log(img); function convertCanvasToImage(canvas) { var image = new Image(); image.src = canvas.toDataURL("image/png"); return image; } </script> </body> </html>
地址:山東省濰坊奎文區新華路樂(lè )川街華誼大廈三樓
網(wǎng)址:http://m.hwj688.cn/ 垂詢(xún)電話(huà):
網(wǎng)站備案:魯ICP備14027302號-5
copyright© 濰坊華邦網(wǎng)絡(luò )有限公司2011-2025