[JavaScript] 纯文本查看 复制代码
<script type="text/javascript">
var puId = 0;
var cuId = 0;
var callBack = function (data) {
if (data.pu) {
puId = data.pu.Uid;
var pname = data.pu.Uname.length > 3 ? (data.pu.Uname.substring(0, 3) + '...') : data.pu.Uname;
var html = "";
html += "<a class=\"gh-login-ok\" target=\"_blank\" href=\"http://my.baidu.com/index.aspx\">";
html += " <img class=\"gh-face\" src=\"" + data.pu.ULogo + "\">";
html += " <span class=\"nick\">" + pname + "</span>";
html += "</a>";
html += "<a href=\"/pub/MainSite.ashx?jsoncallback=?&action=LoginOut\">退出</a>";
$('.gh-login').html( html );
}if (data.cu) {
puId = data.cu.Uid;
}
};
$.ajax({
async: false,
dataType: "jsonp",
jsonp: "callback",
type: "get",
url: 'http://www.baidu.com/pub/MainMaster.ashx?action=checkLogin&=' + new Date().getTime(),
success: callBack
});
</script>