i have the following script, in which i am trying to create a config object for an application :
var myConfig = {
localDBAllowed: function () {
return window.openDatabase;
},
MessageBox: function (message, title) {
if (navigator.notification) {
navigator.notification.alert(message, null, title, 'OK');
} else {
alert(message);
}
},
initializeDb: function(){
if (localDBAllowed) {
messageBox('local db allowed', '');
} else {
messageBox('local db not allowed', '');
}
}
};
myConfig .initializeDb();
the error i get is that localDBAllowed not defined.. from the line : if (localDBAllowed) {
my question is how to access an object's member / method from within the sane object. i tried using this keyword with no success as below:
if (this.localDBAllowed) {
messageBox('local db allowed', '');
this.localDBAllowed) the code works and the condition is executed. Are you perhaps now getting a different error?messageBox(...)should bethis.MessageBox(...)