I'm starting out with classes in Javascript and have hit a wall. I've looked all over for a tutorial that goes a little further than simply how to construct a class (usually Animal) then extend the class and have a Method do something (Dog alert('Bark');).
I have created a class that I want a user to be able to instantiate (is that the right word)? For example the first stage in my program is for the user to give the class a name, and then start to populate the various variables in the class. When they've done that they may do it again many times.
EDITED, FULL EXAMPLE OF CODE:
function Blind() {
this.Type = null;
this.Colour = null;
this.Width = 500;
this.Drop = 500;
this.Price = 0;
}
function BlindAluminium() {
Blind.call(this);
this.Type = 'aluminium';
this.SubType = null;
this.StackHeight = 0;
}
That is the code that defines the object.
Here is the HTML that will allow the user to define a new object:
<form id="create_blind_form" name="create_blind_form" method="post" action="">
<label for="blind_name">Blind Name: <input name="blind_name" id="blind_name" type="text" /></label>
<input name="submit" type="submit" value="Submit" />
</form>
On submitting that I need a new object to be created, in pseudo-code, something like this:
var *blind_name_from_the_form* = new BlindAluminium();
Then later I hope to act on it like this:
*blind_name_from_the_form*.subType = '50mm';