zoukankan      html  css  js  c++  java
  • 调用新浪微博接口,实现“分享”功能——代码实现

    <!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='jquery.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>
  • 相关阅读:
    python安装
    实现node服务器
    VSCode集成tomcat及使用方法
    CommonJS规范
    Bootstrap 笔记
    vue笔记
    jgGrid模板添加
    vue组件中的data
    解析DNS
    StaticResource
  • 原文地址:https://www.cnblogs.com/90nice/p/3728601.html
Copyright © 2011-2022 走看看