PDA

View Full Version : constructor function errors


chrismiceli
11-22-2002, 01:52 AM
i made a constructor function but it is generating errors, what is wrong with my syntax

function val(value) {
this.value = value;
}
"we0" = new val("1");

it generates this error:
Error: invalid assignment left-hand side
Source File: file:///home/cpu/documents/scripts/BaneOfKreeper.html
Line: 13, Column: 6
Source Code:
"we0" = new val("1");

thanx in advanced.

glenngv
11-22-2002, 02:02 AM
you want a variable not a string

we0 = new val("1");
alert(we0.value)

chrismiceli
11-22-2002, 02:07 AM
thanx glen.