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>
  • 相关阅读:
    __del__ 析构方法 __init__ 构造方法
    单态模式
    面向对象小练习2
    __new__ '''魔术方法
    菱形继承
    继承:多继承
    继承: .单继承
    面向对象小练习
    __init__ 魔术方法
    如何访问私有成员
  • 原文地址:https://www.cnblogs.com/90nice/p/3728601.html
Copyright © 2011-2022 走看看