200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > js分享代码(新浪微博 腾讯微博 QQ空间 QQ好友)

js分享代码(新浪微博 腾讯微博 QQ空间 QQ好友)

时间:2021-06-11 11:26:59

相关推荐

js分享代码(新浪微博 腾讯微博 QQ空间 QQ好友)

js分享代码(新浪微博,腾讯微博,QQ空间,QQ好友)

代码如下:

<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>君乐科技js分享代码</title></head><body style="background:#e5e6e6;"><section><div><div class="share-box"><div><p>点击下方图标直接分享</p> <ul><!-- 新浪微博 --><li><a href="javascript:void((function(s,d,e,r,l,p,t,z,c){var%20f='http://v./share/share.php?appkey=真实的appkey',u=z||d.location,p=['&url=',e(u),'&title=',e(t||d.title),'&source=',e(r),'&sourceUrl=',e(l),'&content=',c||'gb2312','&pic=',e(p||'')].join('');function%20a(){if(!window.open([f,p].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,p].join('');};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();})(screen,document,encodeURIComponent,'','','/uploads/allimg/150510/1-150510104044.jpg','君乐科技','','页面编码gb2312|utf-8默认gb2312'));" class="invite-kinds2">新浪微博</a></li><!-- QQ好友 --><li><a href="javascript:;" id="qq_id" target="_blank">QQ好友</a></li><!-- QQ空间 --><li><a href="javascript:;" onclick = "qqZone()">QQ空间</a></li><!-- 腾讯微博 --><li><a href="javascript:;" onclick = "tencentWeiBo()">腾讯微博</a></li></ul></div><div class="ewm" id="qrcode"></div><!-- 参考:jquery.qrcode.js --></div></div></section><hr><h3>直接使用百度分享</h3><div class="bdsharebuttonbox"><a href="#" class="bds_more" data-cmd="more"></a><a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a><a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a><a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a><a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a></div><script>window._bd_share_config={"common":{"bdSnsKey":{},"bdText":"","bdMini":"2","bdMiniList":false,"bdPic":"","bdStyle":"0","bdSize":"32"},"share":{},"image":{"viewList":["weixin","tsina","qzone","tqq"],"viewText":"分享到:","viewSize":"16"},"selectShare":{"bdContainerClass":null,"bdSelectMiniList":["weixin","tsina","qzone","tqq"]}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg./static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script><script type="text/javascript" src="/jquery-1.8.0.min.js"></script><script>var url = "";var desc_ = "君乐科技";function tencentWeiBo(){var _url = ""; var _showcount = 0;var _summary = "";var _title = desc_;var _site = ""; var _width = "600px";var _height = "800px";var _pic = "/uploads/allimg/150510/1-150510104044.jpg";var _shareUrl = 'http://share.v./index.php?c=share&a=index';_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //分享的标题_shareUrl += '&url=' + encodeURIComponent(_url||location.href); //分享的链接_shareUrl += '&appkey=5bd32d6f1dff4725ba40338b233ff155'; //在腾迅微博平台创建应用获取微博AppKey//_shareUrl += '&site=' + encodeURIComponent(_site||''); //分享来源_shareUrl += '&pic=' + encodeURIComponent(_pic||''); //分享的图片,如果是多张图片,则定义var _pic='图片url1|图片url2|图片url3....'window.open(_shareUrl,'width='+_width+',height='+_height+',left='+(screen.width-_width)/2+',top='+(screen.height-_height)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0');} var top = window.screen.height / 2 - 250; var left = window.screen.width / 2 - 300; var height = window.screen.height;var width = window.screen.width; /*title是标题,rLink链接,summary内容,site分享来源,pic分享图片路径,分享到新浪微博*/ function shareTSina() { var title = desc_;var rLink = "";var backUrl = "/member/c_friend";var site = desc_;var pic = "/uploads/allimg/150510/1-150510104044.jpg";window.open("/share/share.php?pic=" +encodeURIComponent(pic) +"&title=" + encodeURIComponent(title.replace(//g, " ").replace(/<br \/>/g, " "))+ "&url=" + encodeURIComponent(rLink), "分享至新浪微博", "height=500,width=600,top=" + top + ",left=" + left + ",toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no"); } function qqFriend() {var p = {url : '', /*获取URL,可加上来自分享到QQ标识,方便统计*/desc:'',//title : '新玩法,再不来你就out了!', /*分享标题(可选)*/title:desc_,summary : '', /*分享摘要(可选)*/pics : '/uploads/allimg/150510/1-150510104044.jpg', /*分享图片(可选)*/flash : '', /*视频地址(可选)*/site : '', /*分享来源(可选) 如:QQ分享*/style : '201',width : 32,height : 32};var s = [];for ( var i in p) {s.push(i + '=' + encodeURIComponent(p[i] || ''));}var url = "/widget/shareqq/index.html?"+s.join('&');return url;//window.location.href = url;//document.write(['<a class="qcShareQQDiv" href="/widget/shareqq/index.html?',s.join('&'), '" >分享给QQ好友</a>' ].join(''));}function qqZone(){var _url = ""; var _showcount = 0;var _desc = desc_;var _summary = "";var _title = "君乐科技";var _site = "";var _width = "600px";var _height = "800px";var _summary = "";var _pic = "/uploads/allimg/150510/1-150510104044.jpg";var _shareUrl = 'http://sns./cgi-bin/qzshare/cgi_qzshare_onekey?';_shareUrl += 'url=' + encodeURIComponent(_url||document.location); //参数url设置分享的内容链接|默认当前页location_shareUrl += '&showcount=' + _showcount||0;//参数showcount是否显示分享总数,显示:'1',不显示:'0',默认不显示_shareUrl += '&desc=' + encodeURIComponent(_desc||'分享的描述'); //参数desc设置分享的描述,可选参数//_shareUrl += '&summary=' + encodeURIComponent(_summary||'分享摘要'); //参数summary设置分享摘要,可选参数_shareUrl += '&title=' + encodeURIComponent(_title||document.title); //参数title设置分享标题,可选参数//_shareUrl += '&site=' + encodeURIComponent(_site||''); //参数site设置分享来源,可选参数_shareUrl += '&pics=' + encodeURIComponent(_pic||''); //参数pics设置分享图片的路径,多张图片以"|"隔开,可选参数window.open(_shareUrl,'width='+_width+',height='+_height+',top='+(screen.height-_height)/2+',left='+(screen.width-_width)/2+',toolbar=no,menubar=no,scrollbars=no,resizable=1,location=no,status=0'); }$(function(){ var url = qqFriend();$("#qq_id").attr("href",url); })</script></body></html>

新浪微博可以直接使用:

var href = "/share/share.php?url=&title=君乐科技&pic=/uploads/allimg/150510/1-150510104424.jpg&appkey=&searchPic=false";

运行效果如下:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。