As others have noted, it's not really possible to see what is wrong with your code without seeing more of it. But the small portion you posted (with its name:value) is valid only in a couple of circumstances, both of which are somewhat common patterns of JS design:
// Pattern one
var makeMyObject = function() {
var privateVar = 'a private member';
var privateMethod = function() {};
var objOut = {
mkDir:function() {/*more code*/},
mkFile:function() {/*more code*/},
delFile:function() {/*more code*/}
};
return objOut;
};
myObject = makeMyObject();
myObject.mkFile();
// Pattern two
var myObject = {
mkDir:function() {/*more code*/},
mkFile:function() {/*more code*/},
delFile:function() {/*more code*/}
};
myObject.mkFile();
If this is what you have, the way you can bind this to an onclick in your HTML code is:
<a href="/some_page.html" onclick="myObject.mkFile()">Click here</a>
Or in your JS,
domMyAnchorElement.onclick = myObject.mkFile; // Note there are no parens because you are binding the function, not invoking it.