2009-02-16 2 views
0

Я пытаюсь отобразить изображение профиля пользователя Facebook с помощью XFBML. Я использую следующий код:Как использовать XFBML.ProfilePic

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

Как установить атрибут uid элемента? (Комментируемая линия не работает)

ответ

3

Установите атрибут перед его отправкой в ​​ProfilePic для обработки:

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