欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

新浪微博分享接口(网页版)

程序员文章站 2022-06-26 16:15:35
...

1、JS

<script type="text/javascript">
        function Tosinaweibo() {
            var PicURL = document.getElementById('img1').src;
            // var _t = encodeURI(document.title);
            var _t = encodeURI("您也来参与一下,一起为中国奥运健儿加油吧!");
            // var _url = encodeURIComponent(document.location);
            //var _url = encodeURIComponent("http://www.xxxx.com");
            var _appkey = encodeURI("333333"); //你从微薄获得的appkey
            var _pic = PicURL;
            var _site = ''; //你的网站地址
            var _u = ' http://service.weibo.com/share/share.php?pic=' + _pic + '&appkey=' + _appkey + '&title=' + _t;
            window.open(_u, '', 'width=600, height=450, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no');
        }
</script>

 

2、HTML

<input id="Button2" type="button" value="一键分享" οnclick="javascript:Tosinaweibo();" />

 

转载于:https://www.cnblogs.com/aishwa/archive/2012/08/06/2624999.html