0
在我的頁面中,有許多超鏈接。我想改變所有的 'A' 與 'UID' 屬性是這樣的:С將所有用戶ID更改爲Facebook名稱
<a href=# uid="5526183">5526183</a>
是
<a href=# uid="5526183">Afrig Aminuddin</a>
另一個例子
<a href=# uid="5526183">My name is 5526183</a>
是
<a href=# uid="5526183">My name is Afrig Aminuddin</a>
首先:我會在'uid'處得到所有'a'標籤貢
var uid=$('a[uid]');
那麼我所說的功能,這個功能纔會被調用一次加載頁面...
named(uid);
這裏是我的職責,
function named(uid){
// here i'd like to do something with the 'uid' array in order it can be
// processed in the next line
// in the next line, the 'uid' must be unique
// so, before that i'd like to filter all the 'uid' array in order to
// filter the double 'uid'
FB.api(
{
method: 'fql.query',
query: 'SELECT name FROM user WHERE uid IN (5526183,1000014057,100001491471735)'
},
function(response) {
// change all the 'a' with 'uid' attribute here...
// response example
return response[0].name; //return the name of 5526183
return response[1].name; //return the name of 1000014057
return response[2].name; //return the name of 100001491471735
}
);}
任何幫助將真正理解...謝謝...... :)
@ivanov:謝謝,但我必須重建我的功能,直到它工作... – theHack 2011-01-28 15:01:18