Re: [問題] function參數的傳遞
// 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
推
09/17 03:26, , 1F
09/17 03:26, 1F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
6
13
Ajax 近期熱門文章
PTT數位生活區 即時熱門文章