分享

把页面分享到开心网,人人网,新浪围脖,QQ书签,百度搜藏

现在web2.0时代,把帖子分享到国内比较火的sns社区获取可以获得更多的人气回报,下面的代码将分享当前页面到开心网 kaixin001.com ,人人网 renren.com ,新浪微博 t.sina.com.cn
代码如下

CSS样式

       #snsshare a {
          color: #000000;
          text-decoration: none;
          font-size: 12px;
          font-weight: normal
      }

      #snsshare span {
          padding: 5px 5px 0px 5px;
          font-size: 12px;
          margin: 0 0 0 10px;
          cursor: pointer;
      }

      #snsshare img {
          border: 0px;
      }

javascript 代码

 
               function share(s) {
                    if (s == 0) {
                        window.open('http://v.t.sina.com.cn/share/share.php?title=' + encodeURIComponent(document.title.substring(0, 76)) + '&url=' + encodeURIComponent(location.href) + '&rcontent=', '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');
                    } else if (s == 1) {
                        window.open('http://www.kaixin001.com/repaste/share.php?rtitle=' + encodeURIComponent(document.title.substring(0, 76)) + '&rurl=' + encodeURIComponent(location.href) + '&rcontent=', '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');
                    } else if (s == 2) {
                        window.open('http://share.renren.com/share/buttonshare.do?title=' + encodeURIComponent(document.title.substring(0, 76)) + '&link=' + encodeURIComponent(location.href) + '&content=', '_blank', 'scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes');
                    } else if (s == 3) {
                        window.open('http://shuqian.qq.com/post?from=3&title=' +
                                encodeURIComponent(document.title) + '&uri=' +
                                encodeURIComponent(document.location.href) +
                                '&jumpback=2&noui=1',
                                'favit',
                                'width=930,height=470,left=50,top=50,
toolbar=no,menubar=no,location=no,
scrollbars=yes,status=no,resizable=yes');
                    } else if (s == 4) {
                        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');
                    }
                }

HTML代码

<div id="snsshare">
<a href="javascript:share(0);" >
<span>
<img alt="转发到新浪微博" src="http://t.sina.com.cn/favicon.ico" align="absMiddle" > 转发到新浪微博</span>
</a>
<a href="javascript:share(1)" >
<span>
<img alt="转帖到开心网" src="http://img1.kaixin001.com.cn/i/favicon.ico" align="absMiddle" > 转帖到开心网
</span>
</a>

<a href="javascript:share(2)" >
<span>
<img alt="转帖到人人网" src="http://s.xnimg.cn/favicon-rr.ico" align="absMiddle" > 转帖到人人网
</span>
</a>

<a href="javascript:share(3)" ><span><img alt="收藏到QQ书签" src="http://www.qq.com/favicon.ico" align="absMiddle" > 收藏到QQ书签</span></a>
<a href="javascript:share(4)" ><span><img alt="添加到百度收藏" src="http://www.baidu.com/favicon.ico" align="absMiddle" > 添加到百度收藏</span></a>
</div>

Tags: , , , ,

星期四, 6 5 月, 2010 Web 没有评论
1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr