分享到QQ空間、新浪微博、騰訊微博的代碼!(收藏)

QQ空間分享代碼以下:
  
<a href= "javascript:void(0);" onclick= "window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+encodeURIComponent(document.location.href));return false;" title= "分享到QQ空間" ><img src= "http://qzonestyle.gtimg.cn/ac/qzone_v5/app/app_share/qz_logo.png" alt= "分享到QQ空間" /></a>
新浪微博分享代碼以下:
  
<script type= "text/javascript" >document.write( '<iframe frameborder="0" scrolling="no" src="http://hits.sinajs.cn/A1/weiboshare.html?url=%url%&appkey=&type=3" width="16" height="16"></iframe>' .replace(/%url%/,encodeURIComponent(location.href)));</script>
騰訊微博分享代碼以下:
  
<a href= "javascript:void(0)" onclick= "postToWb();" class = "tmblog" ><img src= "http://v.t.qq.com/share/images/s/weiboicon16.png" ></a> <script type= "text/javascript" >
  
function postToWb(){
  
var _t = encodeURI(document.title);
  
var _url = encodeURI(document.location);
  
var _appkey = encodeURI( "appkey" ); //你從騰訊得到的appkey
  
var _pic = encodeURI( '' ); //(列如:var _pic='圖片url1|圖片url2|圖片url3....)
  
var _site = ' ';//你的網站地址
  
var _u = ' http: //v.t.qq.com/share/share.php?title='+_t+'&url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic;
  
window.open( _u,'轉播到騰訊微博 ', ' width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no ' );
  
}
  
</script>
QQ朋友社區分享代碼以下:
  
<a href="javascript:void(0);" onclick="window.open(' http: //sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?to=pengyou&url='+encodeURIComponent(document.location.href));return false;" title="分享到朋友社區"><img src="http://qzonestyle.gtimg.cn/ac/qzone_v5/app/qzshare/xy-icon.png" alt="分享到朋友社區" /></a>
這裏發個本身DIY的分享代碼,喜歡的能夠拿去用,預覽圖以下
  
  
圖片素材在壓縮包裏,代碼內容以下,保存爲js文件便可,壓縮包裏也有現成的。
  
document.writeln( "<a href=\"javascript:void((function(s,d,e){try{}catch(e){}var f=\'http:\/\/v.t.sina.com.cn\/share\/share.php?\',u=d.location.href,p=[\'url=\',e(u),\'&title=\',e(d.title),\'&appkey=2924220432\'].join(\'\');function a(){if(!window.open([f,p].join(\'\'),\'mb\',[\'toolbar=0,status=0,resizable=1,width=620,height=450,left=\',(s.width-620)\/2,\',top=\',(s.height-450)\/2].join(\'\')))u.href=[f,p].join(\'\');};if(\/Firefox\/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})(screen,document,encodeURIComponent));\"><img src=\"sina.gif\" \/><\/a>" );
  
document.writeln( "<a href=\"javascript:void(0);\" onclick=\"window.open(\'http:\/\/sns.qzone.qq.com\/cgi-bin\/qzshare\/cgi_qzshare_onekey?url=\'+encodeURIComponent(document.location.href));return false;\"><img src=\"qzone.gif\" \/><\/a>" );
  
document.writeln( "<a href=\"javascript:void(0)\" onclick=\"postToWb();\"><img src=\"sq.gif\" \/><\/a>" );
  
document.writeln( "<script type=\"text\/javascript\">function postToWb(){" );
  
document.writeln( "var _t = encodeURI(document.title);" );
  
document.writeln( "var _url = encodeURI(document.location);" );
  
document.writeln( "var _appkey = encodeURI(\"appkey\");\/\/你從騰訊得到的appkey" );
  
document.writeln( "var _pic = encodeURI(\'\');\/\/(列如:var _pic=\'圖片url1|圖片url2|圖片url3....)" );
  
document.writeln( "var _site = \'\';\/\/你的網站地址" );
  
document.writeln( "var _u = \'http:\/\/v.t.qq.com\/share\/share.php?title=\'+_t+\'&url=\'+_url+\'&appkey=\'+_appkey+\'&site=\'+_site+\'&pic=\'+_pic;" );
  
document.writeln( "window.open( _u,\'轉播到騰訊微博\', \'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no\' );}<\/script>" );
  
document.writeln( "<a href=\"javascript:window.open(\'http:\/\/cang.baidu.com\/do\/add?it=\'+encodeURIComponent(document.title.substring(0,76))+\'&iu=\'+encodeURIComponent(location.href)+\'&fr=ien#nw=1\',\'_blank\',\'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes\'); void 0\"><img src=\"baidu.gif\" \/><\/a>" );
相關文章
相關標籤/搜索