<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>js 分享</title> <style type="text/css"> .style10 {font-size:12px; font-family:宋体; color:#000000; text-decoration:none;}/*黑*/ .share_div{margin:10px 0 5px 0;width:360px;} .share_div a{height:24px;width:24px;display:inline-block;background-image:url('http://www.rencaijj.com/images/share/shares_24.png');background-repeat:no-repeat;padding:0 2px} .xiaoyou_a{background:0 -29px;} .qzone_a{background-position:0 0;} .renren_a{background-position:0 -58px;} .weibo_a{background-position:0 -87px;} .kx001_a{background-position:0 -116px;} .w163_a{background-position:0 -145px;} .sohu_a{background-position:0 -174px;} .tianya_a{background-position:0 -203px;} .qweibo_a{background-position:0 -232px;} </style> <script type="text/javascript"> /* 分享合集(2013-02-19) shareHTML({ url: 'http://www.gzui.net/', title: document.title, desc: '学前端到gzui.net', poto: 'http://www.gzui.net/images/log.gif' //没有留空值 }); by:钟哥 */ var shareList; var s = [], p; function shareHTML(data) { shareList = data; var pid = document.getElementById('PersonID') != null ? document.getElementById('PersonID').value : ''; shareList.url = 'http://www.gzui.net/share.ashx?url=' + shareList.url.replace('http://www.gzui.net', '') + '&pid=' + pid; var sHTML = '<div class="share_div"><span class="style10">分享到: </span><a id="qzone_a" class="qzone_a" target="_blank" title="分享到QQ空间" onclick="shareClick.Qzone()"></a><a id="xiaoyou_a" class="xiaoyou_a" target="_blank" title="分享到腾讯朋友" onclick="shareClick.xiaoyou()"></a><a id="renren_a" class="renren_a" target="_blank" title="分享到人人网" onclick="shareClick.renren()"></a><a id="weibo_a" class="weibo_a" target="_blank" title="分享到新浪微博" onclick="shareClick.weibo()"></a><a id="kx001_a" class="kx001_a" target="_blank" title="分享到开心网" onclick="shareClick.kaixin001()"></a><a id="w163_a" class="w163_a" target="_blank" title="分享到网易微博" onclick="shareClick.w163()"></a><a id="sohu_a" class="sohu_a" target="_blank" title="分享到搜狐微博" onclick="shareClick.sohu()"></a><a id="tianya_a" class="tianya_a" target="_blank" title="分享到天涯" onclick="shareClick.tianya()"></a><a id="qweibo_a" class="qweibo_a" target="_blank" title="分享到腾讯微博" onclick="shareClick.txweibo()"></a></div>'; document.write(sHTML); } var shareClick = { Qzone: function () { p = { url: shareList.url, desc: shareList.desc, summary: '', title: shareList.title, site: '人才济济招聘网', pics: shareList.poto }; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')); } window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?' + s.join('&')); }, xiaoyou: function () { p = { url: shareList.url, desc: shareList.desc, summary: '', title: shareList.title, site: '人才济济招聘网', pics: shareList.poto }; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')); } window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&' + s.join('&')); }, renren: function () { p = { resourceUrl: location.href, srcUrl: shareList.url, pic: shareList.poto, title: shareList.title, description: shareList.desc }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')); } window.open('http://widget.renren.com/dialog/share?' + s.join('&')); }, weibo: function () { p = { url: shareList.url, type: '2', count: '', appkey: '1911864424', title: shareList.desc, ralateUid: '', rnd: new Date().valueOf() }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://service.weibo.com/share/share.php?' + s.join('&')); }, kaixin001: function () { p = { content: shareList.desc, url: shareList.url, starid: 0, aid: '100046628', style: 11, stime: '', sig: '', pic: shareList.poto }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://www.kaixin001.com/rest/records.php?' + s.join('&')); }, w163: function () { p = { link: 'http://www.gzui.net', source: '人才济济', info: shareList.desc + '--' + shareList.url, images: shareList.poto, togImg: 'true' }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://t.163.com/article/user/checkLogin.do?' + s.join('&')); }, sohu: function () { p = { url: shareList.url, title: shareList.desc }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://t.sohu.com/third/post.jsp?' + s.join('&')); }, tianya: function () { p = { shareTo: 2, appkey: "470bca2ef3ce5718396deb7c904fe0a8050e928c6", title: shareList.desc, url: shareList.url, picUrl: shareList.poto, flashVideoUrl: '', tagName: '', relateTYUserName: '' }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://open.tianya.cn/widget/send_for.php?action=send-html&' + s.join('&')); }, txweibo: function () { p = { url: shareList.url, appkey: "801299098", title: shareList.desc, pic: shareList.poto, line1: '' }; s = []; for (var i in p) { s.push(i + '=' + encodeURIComponent(p[i] || '')) } window.open('http://share.v.t.qq.com/index.php?c=share&a=index&' + s.join('&')); } }; function shareWr() { } </script> </head> <body> <script type="text/javascript">shareHTML({ url: 'http://www.gzui.net', title: document.title, desc: '学前端到gzui.net', poto: '' });</script> </body> </html> 提示:你可以先修改部分代码再运行。 转载请注明:有爱前端 » 钟哥 写的 js 分享 喜欢 (0)or分享 (0)