How do I call function that a variable refers to?

Giganews Newsgroups
Subject: How do I call function that a variable refers to?
Posted by:  yaru22 (yaru…@gmail.com)
Date: 2 Sep 2006

Hi. I'm wondering if there is a way to call function that a variable
refers to.

I was writing a script to load xml file.

And what I've written so far looks like this:

var xmlDoc;

function loadXML(xmlFile,xmlMethod)
{
    if (document.implementation &&
document.implementation.createDocument) {
        xmlDoc = document.implementation.createDocument("","",null);
        xmlDoc.load(xmlFile);
        xmlDoc.onload = ???????????;
    } else if (window.ActiveXObject) {
        xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
        xmlDoc.async = false;
        xmlDoc.load(xmlFile);
        ????????????
    } else {
        alert("Your browser cannot handle the script.");
        return;
    }
}

I don't know how to process at '????????' part.

What I wanted to do was calling a function that xmlMethod variable
refers to.

Is there such a way to do it?

Thank you.

Regards,
Brian

Replies