我想創建一個類如「MessageBox
」。在調用Show()
函數時,我將傳遞所需的參數。像:javascript傳遞參數作爲對象或類似
MessageBox.Show(
{
str : "Are you sure?",
onYes : function(){
//do something
},
onNo: function(){
// Do another stuff
}
});
我試了一下:
var MessageBox = {
Show : function(){ // I stuck here
}
}
讓我們展示的JavaScript的功能confirm()
被稱爲內假設。
謝謝老兄。 – 2013-05-07 09:22:57