G
Gene Wirchenko
Dear JavaScripters:
The text I am following has a oddball piece of code. Please
check that I am reading it right.
***** Start of Oddball Code *****
function writeDocument(n,s) {
var doc=parent.frames[1].frames[n].location = s
}
***** End of Oddball Code *****
As I read this, the location for a frame will be set to s. doc,
a local variable, will be set to s as well. But this is all there is
to the function, and therefore, the
var doc=
part of the body serves no useful purpose.
Am I correct in my reading?
Sometimes, I think that errors like this in a text are horrible;
other times, I think it is good exercise. I am undecided here. (I
did not know about JavaScript's multiple assignment, so I suppose that
I have learned something.)
Sincerely,
Gene Wirchenko
The text I am following has a oddball piece of code. Please
check that I am reading it right.
***** Start of Oddball Code *****
function writeDocument(n,s) {
var doc=parent.frames[1].frames[n].location = s
}
***** End of Oddball Code *****
As I read this, the location for a frame will be set to s. doc,
a local variable, will be set to s as well. But this is all there is
to the function, and therefore, the
var doc=
part of the body serves no useful purpose.
Am I correct in my reading?
Sometimes, I think that errors like this in a text are horrible;
other times, I think it is good exercise. I am undecided here. (I
did not know about JavaScript's multiple assignment, so I suppose that
I have learned something.)
Sincerely,
Gene Wirchenko