I was always under the impression that when I change the value of an input box, I would cause an 'onchange' event. Well, turns out that I was mistaken, so now I am stumped.
I wrote a script that changes a value in a textbox, but I don't know how to retrieve that value after it's changed, and use it elsewhere on the page. Like:
I have a class that creates a slider that updates an input value when it's slid, and the input value updates the slider when it's changed. I have three sliders and I'm using them to create a color using their values for the color's r, g, and b values. At least, that's what I'm trying to do.
The problem is getting my Slider class to interact with my ColorPreview class. The ColorPreview class has a ChangeColor(r, g, b) function, and I'd like to access the function.
I tried giving the Slider object a reference to the ColorPreview object, and vice versa, but I always run into problems with the "this" keyword when having them access each others' functions.
"this" only refers to the current object. The object's properties (and methods) are accessed via the object's identifier. This is normally a parameter to the method via data passing.
However, calling the onchange event is more proper I would think.
feyd wrote:"this" only refers to the current object. The object's properties (and methods) are accessed via the object's identifier. This is normally a parameter to the method via data passing.
Precisely.
feyd wrote:However, calling the onchange event is more proper I would think.