文字列を取ることができるかどうか聞いてみましたが、これは常に定数であり、関数の名前をその文字列に追加します。 例:javascriptでは、関数名に文字列を追加することはできますか?
function modifyFunctionName(theFunc)
{
var newFunc = "link" +theFunc;
return newFunc;
}
//Somewhere in the HTML:
<input type='submit' value='button' onclick='modifyFunctionName(CheckLogin())'/>
のでmodifyFunctionName
はlinkCheckLogin()
を返します。
EDIT:質問に基づいてhttps://gist.github.com/2371187
あなたは何をしようとしていますか? –
XY問題(http://mywiki.wooledge.org/XyProblem)の候補に似ています。あなたは本当に何をしようとしていますか? –
OPは、 'CheckLogin()'戻り値に依存して、 'button'に別のイベントハンドラ関数を割り当てたいと思うようです。 – Teemu