Shared Variable

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

    Shared Variable

    Hi all,

    i have a problem with javascript variable.
    I have a script that sets a global variable and open a dialog, then
    when i
    push a button of this dialog and i read the variable, this variable
    isn't set to last value but is not defined.

    How can i do for have equal reference for this variable.?

    Thanks

    Stefano

    I use Mozilla 1.4
  • lallous

    #2
    Re: Shared Variable

    Hello,

    How are you accessing this variable?

    Perhaps you're not accessing the variable correctly...For example to access
    a variable in the opener from the opened window, you would:
    opener.window.t heVar = 'new Value';

    --
    Elias
    "Stefano" <stemon79@liber o.it> wrote in message
    news:8293ce86.0 401230420.32d86 415@posting.goo gle.com...[color=blue]
    > Hi all,
    >
    > i have a problem with javascript variable.
    > I have a script that sets a global variable and open a dialog, then
    > when i
    > push a button of this dialog and i read the variable, this variable
    > isn't set to last value but is not defined.
    >
    > How can i do for have equal reference for this variable.?
    >
    > Thanks
    >
    > Stefano
    >
    > I use Mozilla 1.4[/color]


    Comment

    • Erwin Moller

      #3
      Re: Shared Variable

      Stefano wrote:
      [color=blue]
      > Hi all,
      >
      > i have a problem with javascript variable.
      > I have a script that sets a global variable and open a dialog, then
      > when i
      > push a button of this dialog and i read the variable, this variable
      > isn't set to last value but is not defined.
      >
      > How can i do for have equal reference for this variable.?
      >
      > Thanks
      >
      > Stefano
      >
      > I use Mozilla 1.4[/color]

      Send the script.
      You make a mistake somewhere in your script probably, but how can we tell if
      we don't see it?

      Regards,
      Erwin Moller

      Comment

      • Stefano

        #4
        Re: Shared Variable

        Erwin Moller <since_humans_r ead_this_I_am_s pammed_too_much @spamyourself.c om> wrote in message news:<4011165e$ 0$328$e4fe514c@ news.xs4all.nl> ...[color=blue]
        > Stefano wrote:
        >[color=green]
        > > Hi all,
        > >
        > > i have a problem with javascript variable.
        > > I have a script that sets a global variable and open a dialog, then
        > > when i
        > > push a button of this dialog and i read the variable, this variable
        > > isn't set to last value but is not defined.
        > >
        > > How can i do for have equal reference for this variable.?
        > >
        > > Thanks
        > >
        > > Stefano
        > >
        > > I use Mozilla 1.4[/color]
        >
        > Send the script.
        > You make a mistake somewhere in your script probably, but how can we tell if
        > we don't see it?
        >[/color]
        Hi.
        ok, this is my Javascript code:

        var active_el
        var ed;
        .......
        open_ed();

        function open_ed()
        {
        ed=window.openD ialog("chrome://isawiki/content/myedit.html","E ditor","depende nt");
        ed.innerWidth=2 00;
        ed.innerHeight= 230;
        ed.moveTo(500,3 90);
        }
        ......
        ......
        temp.addEventLi stener('click', set_active_elem ent,true);
        function set_active_elem ent(e)
        {
        active_element( e);
        }
        function active_element( e)
        {
        //alert(e.target. nodeName);
        active_el=e.tar get; //HERE I SET VARIABLE
        if (active_el.chil dNodes.length== 1)
        {
        var vett=active_el. childNodes;
        if ((vett[0].nodeName.toUpp erCase()=="P")& &(!vett[0].innerHTML))
        {active_el=acti ve_el.firstChil d;}//HERE I SET VARIABLE
        }
        .......

        THEN WHEN I CLICK A BUTTON OVER A DIALOG, DIALOG EXECUTES THIS:

        function update()
        {
        alert('hai scelto '+choice);
        //ACTIVE_EL is always null
        if (active_el==nul l)

        {
        select_ok=false ;
        alert('nullo');
        }
        .......

        Thanks, Stefano

        Comment

        Working...