Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #13874
| From | Andreas Bergmaier <andber93@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Variable scope between <script> |
| Date | 2012-05-10 13:19 +0200 |
| Organization | albasani.net |
| Message-ID | <jog879$arn$1@news.albasani.net> (permalink) |
| References | <jof4tq$asa$1@dont-email.me> |
Scott Johnson schrieb: > I tried to call window.location.href ? .pathname which sends back the > original name of the file the script is located '/~domain/music.html' as > expected but not helpful. > > What I was thinking was place the window.location.pathname on the 'home' > page set a global variable which can be read by the script on music.html. > > Is this even possible? > Global variables accessible across scripts. You can access the global object of the parent window with "parent", even the global object of the top window with "top" for deeply nested frames. Precondition is that both pages are located in the same domain for security reasons, which will be no problem in your case. So you may check parent.location.href, but you can also set up a function in the homepage that calls the play() function in the frame by accessing the frame's global object. regards, Bergi
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Variable scope between <script> Scott Johnson <noonehome@chalupasworld.com> - 2012-05-09 18:16 -0700
Re: Variable scope between <script> Andreas Bergmaier <andber93@web.de> - 2012-05-10 13:19 +0200
Re: Variable scope between <script> Scott Johnson <noonehome@chalupasworld.com> - 2012-05-10 05:16 -0700
Re: Variable scope between <script> Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-05-10 19:26 +0200
Re: Variable scope between <script> Richard Cornford <Richard@litotes.demon.co.uk> - 2012-05-10 04:19 -0700
csiph-web