A-A+

分享到新浪微博,qq空间等

2016年10月14日 JavaScript 暂无评论 阅读 123 次

分享到新浪微博

<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<div>
    <p>点击下面的按钮可以将这段文字和图片分享到新浪微博哦!@独行冰海</p>
    <img src='http://t.cn/zRxMzZE' title='独行冰海'/>
    <input type="button" class="btn" id="btn" value='share'>
</div>
</body>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js" ></script>
<script>
    $('#btn').click(function(){
        window.sharetitle = $(this).siblings('p').html();
        window.shareUrl = $(this).siblings('img').attr('src');
        share();
    });
    function share(){
        //d指的是window
        (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(window.sharetitle),'&appkey=2924220432','&pic=',e(window.shareUrl)].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);
    }
</script>
</html>

分享到新浪测试页面

 

<a href="http://service.weibo.com/share/mobile.php?&title=22222" target="_blank">点击按钮1</a>
<a href="http://service.weibo.com/share/mobile.php?&title=%E4%B8%AD%E5%9B%BD%E8%B4%AB%E5%AF%8C%E5%B7%AE%E8%B7%9D%E6%96%B0%E7%89%B9%E7%82%B9%EF%BC%9A%E7%A9%B7%E4%BA%BA%E5%A4%AA%E7%A9%B7%E8%BD%AC%E4%B8%BA%E5%AF%8C%E4%BA%BA%E5%A4%AA%E5%AF%8C-%E8%B4%A2%E7%BB%8F%E9%A2%91%E9%81%93-%E6%89%8B%E6%9C%BA%E6%90%9C%E7%8B%90&url=http%3A%2F%2Fm.sohu.com%2Fn%2F469237091%2F%3Fwscrid%3D1137_7%26_once_%3D000022_shareback_sinaweibo%26appkey%3D217550396%26pic%3D%2F%2Fs8.rr.itc.cn%2Forg%2FwapChange%2F20161_5_11%2Fb8v0r29602064149596.jpg%26ralateUid%3D1934323297%26count%3Dn%26size%3Dmiddle%26frefer%3Dhttp%3A%2F%2Fm.sohu.com%2Fn%2F469237091%2F%3Fwscrid%3D1137_7%26qq-pf-to%3Dpcqq.c2c&appkey=217550396&pic=//s8.rr.itc.cn/org/wapChange/20161_5_11/b8v0r29602064149596.jpg&ralateUid=1934323297&count=n&size=middle" target="_blank">点击按钮</a>
<a href="//service.weibo.com/share/share.php?appkey=&title=%E4%BD%A0%E5%A5%BD%E4%BD%A0%E5%A5%BD&url=&pic=&searchPic=false&style=simple" target="_blank">点击按钮</a>
<a href="http://service.weibo.com/share/share.php?appkey=&title=&url=&pic=&searchPic=false&style=simple" target="_blank">service.weibo.com</a>

<a href="http://v.t.sina.com.cn/share/share.php?&appkey=&url=&title=&pic=&summary=" target="_blank">点击按钮444</a>
<a href="http://v.t.sina.com.cn/share/share.php?&appkey=&url=m.medplus.net%2Factive.html&title=%E6%96%B0%E6%B5%AA%E6%A0%87%E9%A2%98&pic=http:%2F%2Fm.medplus.net%2Fimage%2FSpTemplate%2Ffigure.png&summary=qq%E6%8F%8F%E8%BF%B0&desc=%E5%8C%BB%E6%A0%88" target="_blank">555555</a>

 

标签:

给我留言

Copyright © web前端技术开发个人博客 保留所有权利  京ICP备14060653号 Theme  Ality

用户登录