作者B9 (葉酸酸)
看板Ajax
標題Re: [問題] function參數的傳遞
時間Fri Sep 16 23:03:33 2011
// jsbin:
http://jsbin.com/omavun/1
javascript:(function()
{
"use strict";
var todo = [];
function morning(text)
{
alert("morning" + text);
}
function zaoan(text)
{
alert("zaoan" + text);
}
function matenon(text)
{
alert("matenon" + text);
}
todo.push(morning);
todo.push(zaoan);
todo.push(matenon);
function callbacks(data)
{
var length, cx, callback;
data = /^\S+/.exec(data);
length = todo.length;
for (cx = 0; cx < length; cx++)
{
callback = todo[cx];
callback(data);
}
}
$.get(location.href, callbacks);
})();
--
Oni devas ami animalojn. Ili estas tiel bongustaj.
One should love animals. They are so tasty.
每個人都應該愛動物,他們是如此美味。
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 175.180.52.124
1F:推 timmy852111:實在是太感謝了QAQ 馬上來試試看QQ 09/17 03:26