Bei diesem Code fehlt mir, wie vehicle aufgebaut ist. Ist route_arr prototypisch oder eine in der Initialisierung gesetzte Eigenschaft?
LX, danke für die schnelle Antwort,
hier mehr code:
function vehicle(id) {
this.id = id;
this.route_arr = new Array;
this.date = "";
this.company = "";
this.company_name = "";
this.gate = "";
this.status = "";
this.changed = "";
this.departure_time = "";
this.destination = "";
}
vehicle.prototype = document.createElement("div");
vehicle.prototype.Route_name = function(value) {
if (value != null) {
this.route_arr.push(value);
this.destination = value;
}
else {
var temp = this.route_arr.shift();
this.route_arr.push(temp);
return temp;
}
}
vehicle.prototype.GetDiv = function() {
this.style.width = "30px";
this.style.height = "10px";
this.style.border = "1px solid #bfbfbf";
this.appendChild(document.createTextNode("Test"));
return this;
}
var t = new vehicle(1);
t.departure_time = "03:15";
t.company = "ABCZ-OB";
t.company_name = "Test";
t.Route_name("Test1");
t.Route_name("Test2");
t.gate = "10";
t.status = "1";
t.changed = "0";
Gruß, Markus**