Urgent!!Global window reference!!

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • learner

    #1

    Urgent!!Global window reference!!

    Hi,
    In a page, i have many links.
    I have some functions in a global file which is included in all
    linked pages.
    I want to have a reference to a window which is to be opened on
    clicking one link and it should be known only to one more link on that
    page and not to other links.
    I cant have that window reference in that global file, since iam
    declaring it initially as Null and modifying its value in that one
    particular link. Since all links include this global file they change
    the refernce to Null and its value is lost.
    What can i do for this?

    Plz let me know the earliest..

  • Andrew Thompson

    #2
    Re: Urgent!!Global window reference!!

    On 30 Aug 2004 01:36:22 -0700, learner wrote:
    [color=blue]
    > Urgent!!Global window reference!![/color]

    a) Please give your ..
    <http://www.physci.org/kbd.jsp?key=1+s hift>
    ...key a rest
    [color=blue]
    > Plz let me know the earliest..[/color]

    b) Please do not come in here screaming
    'Urgent' and asking to be told 'the earliest'..
    Your question will be asnswered as soon (and if)
    someone feels like it.

    c) Please note this is not your personal 24Hr
    Help desk, it is acctually a discussion forum,
    as expounded in the FAQ..

    d) You, ..have *checked* the FAQ, haven't you?
    <http://www.jibbering.c om/faq>

    --
    Andrew Thompson
    http://www.PhySci.org/ Open-source software suite
    http://www.PhySci.org/codes/ Web & IT Help
    http://www.1point1C.org/ Science & Technology

    Comment

    • Robert

      #3
      Re: Urgent!!Global window reference!!

      In article <cguou6$rfb@oda h37.prod.google .com>,
      "learner" <v_nithya_v@yah oo.com> wrote:
      [color=blue]
      > Hi,
      > In a page, i have many links.
      > I have some functions in a global file which is included in all
      > linked pages.
      > I want to have a reference to a window which is to be opened on
      > clicking one link and it should be known only to one more link on that
      > page and not to other links.[/color]

      Are you using the HTML anchor tag <a> ?

      In that case, Evertjan, The Netherlands, answered your question in the
      prior post.
      [color=blue]
      > I cant have that window reference in that global file, since iam
      > declaring it initially as Null and modifying its value in that one
      > particular link. Since all links include this global file they change
      > the refernce to Null and its value is lost.[/color]

      The web browser has the responsibility for security and that is a good
      thing. The web browser controls the access to variables in a more
      absolute manor than you see in c/c++.

      How are you getting the window reference? The word link implies you are
      using the anchor tag. The words window reference implies that you are
      using the window.open function.

      Lets say you had files a.html, b.html, and c.html all in the same
      directory. Lets say you did this in file a.html:
      var myData; // written outside of any function

      window.open('b. html',...)
      window.open('c. html',...)

      Javascript functions in both b.html and c.html would be able to access
      variable myData by coding:
      opener.myData

      You will note that functions in b.html and c.html do not have to declare
      opener.myData.

      Browser security will require files a.html, b.html, and c.html to all be
      in the same directory unless you relax the default security settings.
      [color=blue]
      > What can i do for this?[/color]

      I am not certain what your goal is. Are you trying to employ good
      programming practices? Are you trying to encapsulate the data?

      A web application can be very big. The nature of the web forces a
      decentralized coding style. You will not see the monolithic programs you
      find with c/c++ programs. In c/c++, you have to worry more about data
      encapsulation. On the web, I think you will find the pieces are smaller.
      The web forces you to write decentralized programs. You may feel more
      comfortable using global variables in Javascript because there scope is
      smaller in the overall picture of your application.

      You can use closure to encapsulate your variables if you wish.
      See:http://jibbering.com/faq/faq_notes/closures.


      I think you need to redesign your application.

      Robert

      Comment

      Working...