Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #9018 > unrolled thread
| Started by | Gene Wirchenko <genew@ocis.net> |
|---|---|
| First post | 2011-12-08 20:46 -0800 |
| Last post | 2011-12-10 20:37 +0000 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.javascript
Weird Code: Check My Reading of It Gene Wirchenko <genew@ocis.net> - 2011-12-08 20:46 -0800
Re: Weird Code: Check My Reading of It David Mark <dmark.cinsoft@gmail.com> - 2011-12-08 21:34 -0800
Re: Weird Code: Check My Reading of It Norman Peelman <npeelmandog@cfl.rr.com> - 2011-12-09 06:55 -0500
Re: Weird Code: Check My Reading of It David Mark <dmark.cinsoft@gmail.com> - 2011-12-09 12:07 -0800
Re: Weird Code: Check My Reading of It Gene Wirchenko <genew@ocis.net> - 2011-12-09 10:09 -0800
Re: Weird Code: Check My Reading of It Dr J R Stockton <reply1149@merlyn.demon.co.uk> - 2011-12-10 20:37 +0000
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2011-12-08 20:46 -0800 |
| Subject | Weird Code: Check My Reading of It |
| Message-ID | <k243e7ltslnc4op0hd6api696jep2qja0j@4ax.com> |
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
[toc] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2011-12-08 21:34 -0800 |
| Message-ID | <515bf125-7e3b-4ffd-88c8-7dbb22a34647@r28g2000yqj.googlegroups.com> |
| In reply to | #9018 |
On Dec 8, 11:46 pm, Gene Wirchenko <ge...@ocis.net> wrote:
> 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.
Right. Goes right out of scope.
And why they are trying to set the location property is anyone's
guess.
>
> 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
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelmandog@cfl.rr.com> |
|---|---|
| Date | 2011-12-09 06:55 -0500 |
| Message-ID | <jbssv7$5oc$1@dont-email.me> |
| In reply to | #9019 |
On 12/09/2011 12:34 AM, David Mark wrote:
> On Dec 8, 11:46 pm, Gene Wirchenko<ge...@ocis.net> wrote:
>> 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.
>
> Right. Goes right out of scope.
>
Is there an attempt to use 'doc' (this one that has just been
assigned parent.frames[1].frames[n].location) anywhere else in the code?
> And why they are trying to set the location property is anyone's
> guess.
>
I assume to load the new location into the desired frame(n).
>>
>> 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
>
--
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit
[toc] | [prev] | [next] | [standalone]
| From | David Mark <dmark.cinsoft@gmail.com> |
|---|---|
| Date | 2011-12-09 12:07 -0800 |
| Message-ID | <231bce9c-40fc-4229-91b3-ee2b13d5eeea@v6g2000yqv.googlegroups.com> |
| In reply to | #9024 |
On Dec 9, 6:55 am, Norman Peelman <npeelman...@cfl.rr.com> wrote:
> On 12/09/2011 12:34 AM, David Mark wrote:
>
>
>
>
>
>
>
>
>
> > On Dec 8, 11:46 pm, Gene Wirchenko<ge...@ocis.net> wrote:
> >> 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.
>
> > Right. Goes right out of scope.
>
> Is there an attempt to use 'doc' (this one that has just been
> assigned parent.frames[1].frames[n].location) anywhere else in the code?
>
> > And why they are trying to set the location property is anyone's
> > guess.
>
> I assume to load the new location into the desired frame(n).
>
But that's the location.href property. ;)
[toc] | [prev] | [next] | [standalone]
| From | Gene Wirchenko <genew@ocis.net> |
|---|---|
| Date | 2011-12-09 10:09 -0800 |
| Message-ID | <6gj4e7hj2qtrb8817971gadrqgvni89hpg@4ax.com> |
| In reply to | #9024 |
On Fri, 09 Dec 2011 06:55:18 -0500, Norman Peelman
<npeelmandog@cfl.rr.com> wrote:
>On 12/09/2011 12:34 AM, David Mark wrote:
>> On Dec 8, 11:46 pm, Gene Wirchenko<ge...@ocis.net> wrote:
>>> 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.
>>
>> Right. Goes right out of scope.
Thank you.
> Is there an attempt to use 'doc' (this one that has just been
>assigned parent.frames[1].frames[n].location) anywhere else in the code?
I have not entered the code so I can not search it so easily, but
in my eyeball scans of the code, I have seen no other use of doc.
>> And why they are trying to set the location property is anyone's
>> guess.
> I assume to load the new location into the desired frame(n).
Exactly. It is a simple catalog, and the displaying is of a
picture and the product name.
[snip]
Sincerely,
Gene Wirchenko
.
[toc] | [prev] | [next] | [standalone]
| From | Dr J R Stockton <reply1149@merlyn.demon.co.uk> |
|---|---|
| Date | 2011-12-10 20:37 +0000 |
| Message-ID | <CPffKVGnM84OFwCx@invalid.uk.co.demon.merlyn.invalid> |
| In reply to | #9018 |
In comp.lang.javascript message <k243e7ltslnc4op0hd6api696jep2qja0j@4ax.
com>, Thu, 8 Dec 2011 20:46:41, Gene Wirchenko <genew@ocis.net> posted:
>***** Start of Oddball Code *****
>function writeDocument(n,s) {
> var doc=parent.frames[1].frames[n].location = s
>}
>***** End of Oddball Code *****
From the function line, I would half-expect that to have been intended
to write the general HTML string s into the specified frame, in which
case there is a missing (.innerHTML || .somethingElse).
> 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.
Yes. I would have used location.href.
> (I
>did not know about JavaScript's multiple assignment
Be careful with it.
X = Y = 3 ; Y++ ; Z = [+X, +Y] // [3, 4]
X = Y = new Date() ; Y.setTime(3456) ; Z = [+X, +Y] // [3456, 3456]
--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Website <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web