Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13873

Variable scope between <script>

From Scott Johnson <noonehome@chalupasworld.com>
Newsgroups comp.lang.javascript
Subject Variable scope between <script>
Date 2012-05-09 18:16 -0700
Organization A noiseless patient Spider
Message-ID <jof4tq$asa$1@dont-email.me> (permalink)

Show all headers | View raw


I am working with opencart which is templated.

On the foot template file there is a music script (jplayer) located on a 
separate file 'music.html' loaded into a iframe on the footer, which is 
global across all pages.

The client would only like the jplayer to autoplay on the home page so I 
need a way to determine when the home page is called so I can play or 
pause the player in the jplayer script located on 'music.html'.

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.
or
Do I even make sense? :)

Thanks

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


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