Passing variable from external .txt file to field name

Hi - probably a hugely embarrassing beginner question, but I can’t seem to find an answer anywhere. I think it’s probably (hopefully?) just a syntax problem, so if anyone could point me in the right direction I’d be really grateful.

I’m loading the content of a dynamic text box from an external .txt file and I’m trying to find a way to change the content from a link in the .txt file (if that makes sense).

The code I’m using to change the dynamic text box at the moment is:


myData = new LoadVars();
myData.onLoad = function() {
    hometextbox.html = true;
    hometextbox.htmlText = this.newstext;
    hometextbox.scroll = 0;

    if (hometextbox.maxscroll<=hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = false;
        _level0.application.form1.downbutton._visible = false;
    } else if (hometextbox.maxscroll>hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = true;
        _level0.application.form1.downbutton._visible = true;
    }
};
myData.load("Textfile.txt");

and it’s working fine, but I’d like to have a link like


<A HREF="asfunction:MyFunc,contacttext ">Contact</A>

inside my .txt file which changes what is loaded into the dynamic text box.

I thought it might be something like:


function MyFunc(arg){
myData = new LoadVars();
myData.onLoad = function() {
    hometextbox.html = true;
    hometextbox.htmlText = this[arg];
    hometextbox.scroll = 0;

    if (hometextbox.maxscroll<=hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = false;
        _level0.application.form1.downbutton._visible = false;
    } else if (hometextbox.maxscroll>hometextbox.scroll) {
        _level0.application.form1.upbutton._visible = true;
        _level0.application.form1.downbutton._visible = true;
    }
};
myData.load("Textfile.txt");
}

but I’ve had no joy. Can anyone tell me what I’m doing wrong?

Cheers!

  • f