reload

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

    reload

    Hello, I would like to simplify the following script (in a single line)

    parent.botFrame .location="mapa ge.html";
    parent.botFrame .location.reloa d(true);

    is it possible? Thank you
    G.R

  • bengee

    #2
    Re: reload

    Guy Roydor wrote:[color=blue]
    > Hello, I would like to simplify the following script (in a single line)
    >
    > parent.botFrame .location="mapa ge.html";
    > parent.botFrame .location.reloa d(true);
    >
    > is it possible? Thank you[/color]

    Why would you want to try and simplify a program with 2 lines?

    bengee

    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: reload

      Guy Roydor wrote:
      [color=blue]
      > Hello, I would like to simplify the following script (in a single line)
      >
      > parent.botFrame .location="mapa ge.html";
      > parent.botFrame .location.reloa d(true);[/color]

      Line-optimized code is neither easily readable nor reliable.

      Use a reference

      if (parent.frames['botFrame'])
      {
      var f = parent.frames['botFrame'];
      if (f.location && f.reload)
      {
      f.location = "mapage.htm l";
      f.reload(true);
      }
      }

      or the `with' statement:

      if (parent.frames['botFrame'])
      {
      with (parent.frames['botFrame'])
      {
      if (location && reload)
      {
      location = "mapage.htm l";
      reload(true);
      }
      }
      }

      I recommend to use the reference to avoid side effects.


      HTH

      PointedEars

      Comment

      • Guy Roydor

        #4
        Re: reload



        bengee a écrit:[color=blue]
        > Guy Roydor wrote:
        >[color=green]
        >> Hello, I would like to simplify the following script (in a single line)
        >>
        >> parent.botFrame .location="mapa ge.html";
        >> parent.botFrame .location.reloa d(true);
        >>
        >> is it possible? Thank you[/color]
        >
        >
        > Why would you want to try and simplify a program with 2 lines?
        >[/color]

        because parent.botframe contents xxxxx.html ;
        xxxxx.html is reload (and not mapage.html)
        [color=blue]
        > bengee
        >[/color]

        Comment

        Working...