How can I set a property of my object to a variable? The variable is equal to a form textfield value. Both obj.property and obj[property] give me a undefined error when I display the mycar object.
function auto(manufacturer,model,engine_size,year,color,price)
{
this.manufacturer = manufacturer;
this.model = model;
this.engine_size = engine_size;
this.year = year;
this.color = color;
this.price = price;
}
var mycar = new auto();
var a = document.form.num1.value;
mycar.manufacturer = a;
mycar[manufacturer] = a;
sorry. here is all of my code http://jsfiddle.net/vzqjv/
im trying to set my object property to a variable, a, which is equal to a form textfield value after some validation to see if it checks out.
undefinederror, just anundefinedassignment.