128网站目录目前已创建 202 个网站目录,收录 198 个站点! 注册 登录 升级VIP 提交网站
首页 > 新闻中心 > 建站

Js+html 分享到QQ、新浪微博、微信代码

文章内容广告A
<script type="text/javascript">

 function qq(title,url,pic){

  var p = {

   url: '这里填写你要分享的url', /*要分享的url*/

   title:  '这里填写你要分享的文字内容',/* 分享的文字内容(可选,默认为所在页面的title)*/

   summary: '',

   desc:'',

   pics : pic,/*分享图片(可选)*/

   flash : '', /*视频地址(可选)*/

   commonClient : true, /*客户端嵌入标志*/

   site: 'QQ'/*分享来源 (可选) ,如:QQ分享*/

      };

      var s = [];

      for (var i in p) {

   s.push(i + '=' + encodeURIComponent(p[i] || ''));

      }

      var target_url = "
http://connect.qq.com/widget/shareqq/iframe_index.html
?" + s.join('&') ;

       window.open(target_url, 'qq','height=520, width=720');

 }

 function sinaWeiBo(title,url,pic){

   var param = {

    
url:'
这里填写你要分享的url', /*要分享的url*/

    type:'3',

    count:'1', /* 是否显示分享数,1显示(可选)*/

    appkey:'北京', /* 您申请的应用appkey,显示分享来源(可选)*/

    title:'', /* 分享的文字内容(可选,默认为所在页面的title)*/

    rnd:new Date().valueOf()

    }

   var temp = [];

   for( var p in param ){

   temp.push(p + '=' +encodeURIComponent( param[p ] || '' ) )

   }

   var target_url = "
http://service.weibo.com/share/share.php?"+temp.join('&'
);

   window.open(target_url, 'sinaweibo', 'height=430, width=400');

 }

 function weixin(title,url,pic){

  var target_url ="
http://qr.liantu.com/api.php?text
=你要分享的URL";

  window.open(target_url,'sinaweixin','height=630, width=900');

  }

</script>

<body>

 <div align="center">

  <a href="javascript:void(0);" onclick="qq();" >

      <img src="" width="40" height="40" title="分享到QQ" alt="分享到QQ"/>

  </a>

  <a href="javascript:void(0);" onclick="sinaWeiBo();" >

      <img src="" title="分享到微博?" alt="分享到微博"/>

  </a>

  <a href="javascript:void(0);" onclick="weixin();" >

      <img src="" title="分享到微信" alt="分享到微信"/>

  </a>

 </div>

</body>