分享到新浪微博,腾讯微博,网易微博,开心,人人,豆瓣

找了一下午,终于找到了,整理下,来自58团购的代码:

  
    
1 <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
2 < html xmlns ="http://www.w3.org/1999/xhtml" >
3 < head >
4 < meta http-equiv ="Content-Type" content ="text/html; charset=utf-8" />
5 < title > 分享到新浪微博,腾讯微博,网易微博,开心,人人,豆瓣 </ title >
6 </ head >
7 < body >
8 < div id ="shareList" > < span > 分享到: </ span >
9 < a href ="javascript:void(0)" name ="tqq" > QQ微博 </ a >
10 < a href ="javascript:void(0)" name ="sina" > 新浪微博 </ a >
11 < a href ="javascript:void(0)" name ="kaixin" > 开心网 </ a >
12 < a href ="javascript:void(0)" name ="renren" > 人人网 </ a >
13 < a href ="javascript:void(0)" name ="douban" > 豆瓣 </ a >
14 < a href ="javascript:void(0)" name ="t163" > 163 </ a >
15 </ div >
16 < script type ="text/javascript" >
17 var product = {
18 " name " : ' 肯德基96元超级全家桶超值特卖:新奥尔良烤翅1对&中杯可乐1杯;德克萨斯风味烤鸡腿堡+香辣鸡翅2块+九珍果汁1杯;中杯可乐1杯;或香辣/劲脆鸡腿堡1个+德克萨斯浓香风味鸡翅2块+九珍果汁1杯 ' ,
19 " shortname " : " 肯德基超级全家桶 " ,
20 " image " : " http://www.4008823823.com.cn/kfc/productpics/2011May/images/kjtb.jpg " ,
21 " address " : " 北京 " ,
22 " url " :document.location.href
23 };
24 var a = document.getElementById( ' shareList ' ).getElementsByTagName( ' a ' );
25 for ( var i = 0 ;i < a.length;i ++ ){
26 a[i].onclick = function (){
27 if ( typeof (share) == ' function ' ){share( this .name,product);
28 }
29 };
30 /*
31 1.appkey为你在各开放平台注册密钥
32 2.人人和豆瓣本地链接无法测试
33 3.【】里为你的微博账号
34 4.product里为你要分享的内容
35 */
36 function share(name,product){
37 if ( typeof (product) != ' undefined ' && product != '' ){
38 switch (name){
39 // sina
40 case ' sina ' :
41 var url = ' http://v.t.sina.com.cn/share/share.php?appkey=290510723&url= ' + product.url + ' &title= ' + encodeURIComponent( " 【@YOU】【 " + product.address + " " + product.name) + ' &pic= ' + encodeURIComponent(product.image);
42 window.open(url);
43 break
44
45 // QQ
46 case ' tqq ' :
47 var url = ' http://v.t.qq.com/share/share.php?title= ' + encodeURIComponent( " 【@YOU】【 " + product.address + " " + product.name) + ' &url= ' + product.url + ' &appkey= ' + encodeURI( "" ) + ' &site= ' + product.url + ' &pic= ' + product.image;
48 window.open( url, ' 转播到腾讯微博 ' , ' width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no ' );
49 break
50
51 // kaixin
52 case ' kaixin ' :
53 var url = ' http://www.kaixin001.com/repaste/share.php?rurl= ' + product.url + ' &rcontent= ' + encodeURIComponent( " 【YOU】 " + product.name + product.url) + ' &rtitle= ' + encodeURIComponent(product.shortname);
54 window.open(url);
55 break
56
57 // renren
58 case ' renren ' :
59 var url = ' http://share.renren.com/share/buttonshare.do?link= ' + product.url + ' &title= ' + encodeURIComponent( " 【YOU】 " + product.name);
60 window.open(url);
61 break
62
63 // douban
64 case ' douban ' :
65 var url = ' http://www.douban.com/recommend/?url= ' + product.url + ' &title= ' + encodeURIComponent( " 【YOU】 " + product.name);
66 window.open(url);
67 break
68
69 // 163
70 case ' t163 ' :
71 var url = ' link=http://t.58.com/&source= ' + encodeURIComponent( ' YOU ' ) + ' &info= ' + encodeURIComponent( " 【YOU】【 " + product.address + " " + product.name) + ' ' + encodeURIComponent(product.url);
72 window.open( ' http://t.163.com/article/user/checkLogin.do? ' + url + ' & ' + new Date().getTime(), ' newwindow ' , ' height=330,width=550,top= ' + (screen.height - 280 ) / 2+',left='+(screen.width-550) / 2 + ' , toolbar=no, menubar=no, scrollbars=no,resizable=yes,location=no, status=no ' );
73 break
74 }
75 }
76 }
77 }
78 </ script >
79 </ body >
80 </ html >

你可能感兴趣的:(新浪微博)