Javascript 如何使用XFBML.ProfilePic

Javascript 如何使用XFBML.ProfilePic,javascript,facebook,xfbml,Javascript,Facebook,Xfbml,我正在尝试使用XFBML显示Facebook用户的个人资料图片。我正在使用以下代码: var container = document.getElementById("profilePicture"); var profilePic = new FB.XFBML.ProfilePic(container); //profilePic.setAttribute("uid", userId); FB.XFBML.Host.addElement(profilePic); 如何设置元素的uid属性?(

我正在尝试使用XFBML显示Facebook用户的个人资料图片。我正在使用以下代码:

var container = document.getElementById("profilePicture");
var profilePic = new FB.XFBML.ProfilePic(container);
//profilePic.setAttribute("uid", userId);
FB.XFBML.Host.addElement(profilePic);

如何设置元素的uid属性?(注释行不起作用)

在将属性发送到ProfilePic进行处理之前设置该属性:

var container = document.getElementById("profilePicture");
container.setAttribute("uid", userId);
var profilePic = new FB.XFBML.ProfilePic(container);
FB.XFBML.Host.addElement(profilePic);

在将属性发送到ProfilePic进行处理之前设置该属性:

var container = document.getElementById("profilePicture");
container.setAttribute("uid", userId);
var profilePic = new FB.XFBML.ProfilePic(container);
FB.XFBML.Host.addElement(profilePic);