oooh! You mention instance. In that regard you may retain the private membership of the variable like this:
function MyClass(){
var myString = "Hello World";
this.setMyString = function(isTxt){myString=isTxt;alert(myString)}
}
instance=new MyClass;
...
<a href="javascript:instance.setMyString('Hello Again')">
Above variable instance is defined by the MyClass and may retain it's inherited values!
Otherwise you could use this code:
function MyClass(){
this.myString = "Hello World";
}
function setMyString(isTxt){MyClass.myString=isTxt;alert(MyClass.myString)}
...
<a href="javascript:setMyString('Hello Again')">
The first example is the preferred way of doing things, although the browser sandbox should keep everything private. The second example does expose the
myString variable to global scope on the document as does my first example.
Any way it goes the events are fired by the DOM, and the best way to call from the HTML is with a function/method rather than direct assignment. The DOM also allows you to attach events dynamically via javascript. Here it is the assumption that by caller you mean mouse clicks on the document.
WHAT you;see_is_what=you.get;
-Russ aka DangeRuss