Assuming you have a function on the OnLoad Event, and you want to access a variable of the function on the OnSave / ISV button of that entity, do the following
//the following method has an Object named NameObject.
//and also a local variable localName
//ON LOAD
function ObjectOrientedTest()
{
NameObject = function ()
{
this.firstName = "Geoffrey";
this.lastName = "Joe";
this.fullName = "Geoffrey Joe Ignatius";
this.systemUserId = "igeoff";
}
var localName="GI Joe";
}
//ON SAVE
function CallObjectOrientedTest()
{
//trying to access the variable in the NameObject
var nn = new NameObject();
alert(nn.firstName); //WILL SUCCEED
alert(localName); //WILL FAIL
}
No comments:
Post a Comment