新浪微博开放平台接入

新浪微博开放平台接入

代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>登陆到微博</title> 
</head> 
<body>
	<span id="wb_connect_btn"></span> 
	下面这个按钮在登录、退出成功后执行指定的回调函数
	<span id="wb_connect_btn2"></span> 
<script type="text/javascript" src="http://tjs.sjs.sinajs.cn/open/api/js/wb.js?appkey=1166443256"></script> 
<script type="text/javascript"> 
WB2.anyWhere(function(W){
	W.widget.connectButton({
		id: "wb_connect_btn"
	});
	
	W.widget.connectButton({
		id: "wb_connect_btn2",
		callback : {
			login:function(o){
				alert("1: "+o.screen_name)
			},
			logout:function(){
				alert('logout 1');
			}
		}
	});
});
</script> 
</body> 
</html>


你可能感兴趣的:(新浪微博开放平台接入)