You are testing the values of
x[k]
and
y[k]
before you have created them with the
parseInt
command. Also you will only show the alert if both values are undefined, you should use the
||
(logical OR) operator.
[edit]You could also try reading
this[
^] and
this[
^].[/edit]