checking for what file loaded in a frame..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frances Del Rio

    #1

    checking for what file loaded in a frame..

    if (parent.frames. main.location == 'mediaselect.ht ml') {

    I have a very simple frameset, name of frame where I'm checking is
    'main'... why is this not working? I mean this is correct syntax,
    right?? I also put a test alert, but alert does not come up if file
    I'm testing for is loaded in 'main' frame.. thank you.. Frances






  • Ivo

    #2
    Re: checking for what file loaded in a frame..

    "Frances Del Rio" wrote[color=blue]
    > if (parent.frames. main.location == 'mediaselect.ht ml') {
    >
    > I have a very simple frameset, name of frame where I'm checking is
    > 'main'... why is this not working? I mean this is correct syntax,
    > right?? I also put a test alert, but alert does not come up if file
    > I'm testing for is loaded in 'main' frame.. thank you.. Frances[/color]

    You don't want the location object, but its href property.
    Try
    if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
    or
    alert( parent.frames.m ain.location.hr ef );
    first perhaps.
    And beware that all sorts of nasty cross-domain security restriction errors
    happen if the main frame happens to contain a document from another domain.
    --
    Ivo


    Comment

    • RobB

      #3
      Re: checking for what file loaded in a frame..

      Ivo wrote:[color=blue]
      > "Frances Del Rio" wrote[color=green]
      > > if (parent.frames. main.location == 'mediaselect.ht ml') {
      > >
      > > I have a very simple frameset, name of frame where I'm checking is
      > > 'main'... why is this not working? I mean this is correct syntax,
      > > right?? I also put a test alert, but alert does not come up if[/color][/color]
      file[color=blue][color=green]
      > > I'm testing for is loaded in 'main' frame.. thank you.. Frances[/color]
      >
      > You don't want the location object, but its href property.
      > Try
      > if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
      > or
      > alert( parent.frames.m ain.location.hr ef );
      > first perhaps.
      > And beware that all sorts of nasty cross-domain security restriction[/color]
      errors[color=blue]
      > happen if the main frame happens to contain a document from another[/color]
      domain.[color=blue]
      > --
      > Ivo[/color]

      For most applications, the Location object - presumably due to its
      importance - can be both written to & read as if it were a string (just
      like its .href property). You're comparing a relative url to a
      fully-qualified one. Try:

      if (parent.frames. main.location.h ref.search('med iaselect.html') > -1)
      {....

      Calling a String method so, you'll need that .href in this case.

      Comment

      • Frances Del Rio

        #4
        Re: checking for what file loaded in a frame..



        RobB wrote:[color=blue]
        > Ivo wrote:
        >[color=green]
        >>"Frances Del Rio" wrote
        >>[color=darkred]
        >>>if (parent.frames. main.location == 'mediaselect.ht ml') {
        >>>
        >>>I have a very simple frameset, name of frame where I'm checking is
        >>>'main'... why is this not working? I mean this is correct syntax,
        >>>right?? I also put a test alert, but alert does not come up if[/color][/color]
        >
        > file
        >[color=green][color=darkred]
        >>>I'm testing for is loaded in 'main' frame.. thank you.. Frances[/color]
        >>
        >>You don't want the location object, but its href property.
        >>Try
        >>if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
        >>or
        >>alert( parent.frames.m ain.location.hr ef );
        >>first perhaps.
        >>And beware that all sorts of nasty cross-domain security restriction[/color]
        >
        > errors
        >[color=green]
        >>happen if the main frame happens to contain a document from another[/color]
        >
        > domain.
        >[color=green]
        >>--
        >>Ivo[/color]
        >
        >
        > For most applications, the Location object - presumably due to its
        > importance - can be both written to & read as if it were a string (just
        > like its .href property). You're comparing a relative url to a
        > fully-qualified one. Try:
        >
        > if (parent.frames. main.location.h ref.search('med iaselect.html') > -1)
        > {....
        >
        > Calling a String method so, you'll need that .href in this case.[/color]

        thank you very much Rob & Ivo for yr responses.. ok, after following yr
        suggestion this is what I now have...

        <script language="JavaS cript" type="text/javascript">
        if (parent.frames. main.location.h ref.search('med iaselect.html') > -1) {
        // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
        alert(' ')
        document.write( " ")
        } else {
        document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
        document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
        height="24" border="0"></a></div>')
        }
        </script>

        alert pops ok now, but: wben I switch to a file in that main frame
        other than file mentioned in conditional cond. is still not met (i.e.,
        that img/link still does not appear..)

        I also tried this:

        <script language="JavaS cript" type="text/javascript">
        if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
        document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
        document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
        height="24" border="0"></a></div>')
        }
        if (parent.frames. main.location.h ref.search('wmp .html') > -1)
        document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
        document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
        height="24" border="0"></a></div>')
        }
        </script>

        and got exact same result..
        this:
        if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
        (parent.frames. main.location.h ref.search('aud io.html') > -1) {

        gave me an error on those '||'...... don't know what that's about either..

        I don't understand why this is such a problem... I also use this
        (to make sure a certain file is loaded in a frame when I reload):

        function loc() {
        parent.frames.m ain.location = 'mediaselect.ht ml'
        }

        and call function in onload event handler in body tag.. and this works
        fine.. why is testing whether or not a certain file is loaded in a frame
        such a problem? again, many thanks for yr help.. Frances








        Comment

        • Frances Del Rio

          #5
          Re: checking for what file loaded in a frame..



          Frances Del Rio wrote:
          [color=blue]
          >
          >
          > RobB wrote:
          >[color=green]
          >> Ivo wrote:
          >>[color=darkred]
          >>> "Frances Del Rio" wrote
          >>>
          >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
          >>>>
          >>>> I have a very simple frameset, name of frame where I'm checking is
          >>>> 'main'... why is this not working? I mean this is correct syntax,
          >>>> right?? I also put a test alert, but alert does not come up if[/color]
          >>
          >>
          >> file
          >>[color=darkred]
          >>>> I'm testing for is loaded in 'main' frame.. thank you.. Frances
          >>>
          >>>
          >>> You don't want the location object, but its href property.
          >>> Try
          >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
          >>> or
          >>> alert( parent.frames.m ain.location.hr ef );
          >>> first perhaps.
          >>> And beware that all sorts of nasty cross-domain security restriction[/color]
          >>
          >>
          >> errors
          >>[color=darkred]
          >>> happen if the main frame happens to contain a document from another[/color]
          >>
          >>
          >> domain.
          >>[color=darkred]
          >>> --
          >>> Ivo[/color]
          >>
          >>
          >>
          >> For most applications, the Location object - presumably due to its
          >> importance - can be both written to & read as if it were a string (just
          >> like its .href property). You're comparing a relative url to a
          >> fully-qualified one. Try:
          >>
          >> if (parent.frames. main.location.h ref.search('med iaselect.html') > -1)
          >> {....
          >>
          >> Calling a String method so, you'll need that .href in this case.[/color]
          >
          >
          > thank you very much Rob & Ivo for yr responses.. ok, after following yr
          > suggestion this is what I now have...
          >
          > <script language="JavaS cript" type="text/javascript">
          > if (parent.frames. main.location.h ref.search('med iaselect.html') > -1) {
          > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
          > alert(' ')
          > document.write( " ")
          > } else {
          > document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
          > document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
          > height="24" border="0"></a></div>')
          > }
          > </script>
          >
          > alert pops ok now, but: wben I switch to a file in that main frame
          > other than file mentioned in conditional cond. is still not met (i.e.,
          > that img/link still does not appear..)
          >
          > I also tried this:
          >
          > <script language="JavaS cript" type="text/javascript">
          > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
          > document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
          > document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
          > height="24" border="0"></a></div>')
          > }
          > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
          > document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
          > document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
          > height="24" border="0"></a></div>')
          > }
          > </script>
          >
          > and got exact same result..
          > this:
          > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
          > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
          >
          > gave me an error on those '||'...... don't know what that's about either..
          >
          > I don't understand why this is such a problem... I also use this
          > (to make sure a certain file is loaded in a frame when I reload):
          >
          > function loc() {
          > parent.frames.m ain.location = 'mediaselect.ht ml'
          > }
          >
          > and call function in onload event handler in body tag.. and this works
          > fine.. why is testing whether or not a certain file is loaded in a frame
          > such a problem? again, many thanks for yr help.. Frances[/color]

          ooopss.. had forgotten a '{'.. but even after correcting this it's still
          not working.. now I put everything in a function..

          function check() {
          if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
          alert('')
          document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
          document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
          height="24" border="0"></a></div>')
          }
          if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
          alert('')
          document.write( '<div id="sel"><a href="mediasele ct.html" target="main">' )
          document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
          height="24" border="0"></a></div>')
          }
          }

          and call function in body of file.. (also tried calling function in
          body tag.. (onload... etc...)

          <script language="JavaS cript" type="text/javascript">
          check();
          </script>

          I do get alert now, but if wmp.html or audio.html are loaded img/link I
          want does not appear... I want it to appear if either of these two
          files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
          don't want it to appear..) again, thank you for your help.. Frances





          Comment

          • RobB

            #6
            Re: checking for what file loaded in a frame..

            Frances Del Rio wrote:[color=blue]
            > Frances Del Rio wrote:
            >[color=green]
            > >
            > >
            > > RobB wrote:
            > >[color=darkred]
            > >> Ivo wrote:
            > >>
            > >>> "Frances Del Rio" wrote
            > >>>
            > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
            > >>>>
            > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
            is[color=blue][color=green][color=darkred]
            > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
            syntax,[color=blue][color=green][color=darkred]
            > >>>> right?? I also put a test alert, but alert does not come up if
            > >>
            > >>
            > >> file
            > >>
            > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
            Frances[color=blue][color=green][color=darkred]
            > >>>
            > >>>
            > >>> You don't want the location object, but its href property.
            > >>> Try
            > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
            > >>> or
            > >>> alert( parent.frames.m ain.location.hr ef );
            > >>> first perhaps.
            > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
            restriction[color=blue][color=green][color=darkred]
            > >>
            > >>
            > >> errors
            > >>
            > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
            another[color=blue][color=green][color=darkred]
            > >>
            > >>
            > >> domain.
            > >>
            > >>> --
            > >>> Ivo
            > >>
            > >>
            > >>
            > >> For most applications, the Location object - presumably due to its
            > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
            (just[color=blue][color=green][color=darkred]
            > >> like its .href property). You're comparing a relative url to a
            > >> fully-qualified one. Try:
            > >>
            > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
            -1)[color=blue][color=green][color=darkred]
            > >> {....
            > >>
            > >> Calling a String method so, you'll need that .href in this case.[/color]
            > >
            > >
            > > thank you very much Rob & Ivo for yr responses.. ok, after[/color][/color]
            following yr[color=blue][color=green]
            > > suggestion this is what I now have...
            > >
            > > <script language="JavaS cript" type="text/javascript">
            > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
            -1) {[color=blue][color=green]
            > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
            > > alert(' ')
            > > document.write( " ")
            > > } else {
            > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
            target="main">' )[color=blue][color=green]
            > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
            width="138"[color=blue][color=green]
            > > height="24" border="0"></a></div>')
            > > }
            > > </script>
            > >
            > > alert pops ok now, but: wben I switch to a file in that main frame[/color][/color]
            [color=blue][color=green]
            > > other than file mentioned in conditional cond. is still not met[/color][/color]
            (i.e.,[color=blue][color=green]
            > > that img/link still does not appear..)
            > >
            > > I also tried this:
            > >
            > > <script language="JavaS cript" type="text/javascript">
            > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
            > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
            target="main">' )[color=blue][color=green]
            > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
            width="138"[color=blue][color=green]
            > > height="24" border="0"></a></div>')
            > > }
            > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
            > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
            target="main">' )[color=blue][color=green]
            > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
            width="138"[color=blue][color=green]
            > > height="24" border="0"></a></div>')
            > > }
            > > </script>
            > >
            > > and got exact same result..
            > > this:
            > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
            > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
            > >
            > > gave me an error on those '||'...... don't know what that's about[/color][/color]
            either..[color=blue][color=green]
            > >
            > > I don't understand why this is such a problem... I also use this
            > > (to make sure a certain file is loaded in a frame when I reload):
            > >
            > > function loc() {
            > > parent.frames.m ain.location = 'mediaselect.ht ml'
            > > }
            > >
            > > and call function in onload event handler in body tag.. and this[/color][/color]
            works[color=blue][color=green]
            > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
            frame[color=blue][color=green]
            > > such a problem? again, many thanks for yr help.. Frances[/color]
            >
            > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
            still[color=blue]
            > not working.. now I put everything in a function..
            >
            > function check() {
            > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
            > alert('')
            > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
            target="main">' )[color=blue]
            > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
            width="138"[color=blue]
            > height="24" border="0"></a></div>')
            > }
            > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
            > alert('')
            > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
            target="main">' )[color=blue]
            > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
            width="138"[color=blue]
            > height="24" border="0"></a></div>')
            > }
            > }
            >
            > and call function in body of file.. (also tried calling function in
            > body tag.. (onload... etc...)
            >
            > <script language="JavaS cript" type="text/javascript">
            > check();
            > </script>
            >
            > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
            I[color=blue]
            > want does not appear... I want it to appear if either of these two
            > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
            > don't want it to appear..) again, thank you for your help.. Frances[/color]

            Can't call document.write( ) on a loaded document as it discards the
            current one, although it may appear to be successful in some browsers.
            Try including that div in the original page and setting its .innerHTML
            property (document.getEl ementById('sel' ).innerHTML) to the link/img
            HTML string you need.

            Comment

            • RobB

              #7
              Re: checking for what file loaded in a frame..

              Frances Del Rio wrote:[color=blue]
              > Frances Del Rio wrote:
              >[color=green]
              > >
              > >
              > > RobB wrote:
              > >[color=darkred]
              > >> Ivo wrote:
              > >>
              > >>> "Frances Del Rio" wrote
              > >>>
              > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
              > >>>>
              > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
              is[color=blue][color=green][color=darkred]
              > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
              syntax,[color=blue][color=green][color=darkred]
              > >>>> right?? I also put a test alert, but alert does not come up if
              > >>
              > >>
              > >> file
              > >>
              > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
              Frances[color=blue][color=green][color=darkred]
              > >>>
              > >>>
              > >>> You don't want the location object, but its href property.
              > >>> Try
              > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
              > >>> or
              > >>> alert( parent.frames.m ain.location.hr ef );
              > >>> first perhaps.
              > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
              restriction[color=blue][color=green][color=darkred]
              > >>
              > >>
              > >> errors
              > >>
              > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
              another[color=blue][color=green][color=darkred]
              > >>
              > >>
              > >> domain.
              > >>
              > >>> --
              > >>> Ivo
              > >>
              > >>
              > >>
              > >> For most applications, the Location object - presumably due to its
              > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
              (just[color=blue][color=green][color=darkred]
              > >> like its .href property). You're comparing a relative url to a
              > >> fully-qualified one. Try:
              > >>
              > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
              -1)[color=blue][color=green][color=darkred]
              > >> {....
              > >>
              > >> Calling a String method so, you'll need that .href in this case.[/color]
              > >
              > >
              > > thank you very much Rob & Ivo for yr responses.. ok, after[/color][/color]
              following yr[color=blue][color=green]
              > > suggestion this is what I now have...
              > >
              > > <script language="JavaS cript" type="text/javascript">
              > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
              -1) {[color=blue][color=green]
              > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
              > > alert(' ')
              > > document.write( " ")
              > > } else {
              > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
              target="main">' )[color=blue][color=green]
              > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
              width="138"[color=blue][color=green]
              > > height="24" border="0"></a></div>')
              > > }
              > > </script>
              > >
              > > alert pops ok now, but: wben I switch to a file in that main frame[/color][/color]
              [color=blue][color=green]
              > > other than file mentioned in conditional cond. is still not met[/color][/color]
              (i.e.,[color=blue][color=green]
              > > that img/link still does not appear..)
              > >
              > > I also tried this:
              > >
              > > <script language="JavaS cript" type="text/javascript">
              > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
              > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
              target="main">' )[color=blue][color=green]
              > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
              width="138"[color=blue][color=green]
              > > height="24" border="0"></a></div>')
              > > }
              > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
              > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
              target="main">' )[color=blue][color=green]
              > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
              width="138"[color=blue][color=green]
              > > height="24" border="0"></a></div>')
              > > }
              > > </script>
              > >
              > > and got exact same result..
              > > this:
              > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
              > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
              > >
              > > gave me an error on those '||'...... don't know what that's about[/color][/color]
              either..[color=blue][color=green]
              > >
              > > I don't understand why this is such a problem... I also use this
              > > (to make sure a certain file is loaded in a frame when I reload):
              > >
              > > function loc() {
              > > parent.frames.m ain.location = 'mediaselect.ht ml'
              > > }
              > >
              > > and call function in onload event handler in body tag.. and this[/color][/color]
              works[color=blue][color=green]
              > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
              frame[color=blue][color=green]
              > > such a problem? again, many thanks for yr help.. Frances[/color]
              >
              > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
              still[color=blue]
              > not working.. now I put everything in a function..
              >
              > function check() {
              > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
              > alert('')
              > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
              target="main">' )[color=blue]
              > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
              width="138"[color=blue]
              > height="24" border="0"></a></div>')
              > }
              > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
              > alert('')
              > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
              target="main">' )[color=blue]
              > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
              width="138"[color=blue]
              > height="24" border="0"></a></div>')
              > }
              > }
              >
              > and call function in body of file.. (also tried calling function in
              > body tag.. (onload... etc...)
              >
              > <script language="JavaS cript" type="text/javascript">
              > check();
              > </script>
              >
              > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
              I[color=blue]
              > want does not appear... I want it to appear if either of these two
              > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
              > don't want it to appear..) again, thank you for your help.. Frances[/color]

              Can't call document.write( ) on a loaded document as it discards the
              current one, although it may appear to be successful in some browsers.
              Try including that div in the original page and setting its .innerHTML
              property (document.getEl ementById('sel' ).innerHTML) to the link/img
              HTML string you need.

              Comment

              • RobB

                #8
                Re: checking for what file loaded in a frame..

                Frances Del Rio wrote:[color=blue]
                > Frances Del Rio wrote:
                >[color=green]
                > >
                > >
                > > RobB wrote:
                > >[color=darkred]
                > >> Ivo wrote:
                > >>
                > >>> "Frances Del Rio" wrote
                > >>>
                > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
                > >>>>
                > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
                is[color=blue][color=green][color=darkred]
                > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
                syntax,[color=blue][color=green][color=darkred]
                > >>>> right?? I also put a test alert, but alert does not come up if
                > >>
                > >>
                > >> file
                > >>
                > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
                Frances[color=blue][color=green][color=darkred]
                > >>>
                > >>>
                > >>> You don't want the location object, but its href property.
                > >>> Try
                > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                > >>> or
                > >>> alert( parent.frames.m ain.location.hr ef );
                > >>> first perhaps.
                > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
                restriction[color=blue][color=green][color=darkred]
                > >>
                > >>
                > >> errors
                > >>
                > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
                another[color=blue][color=green][color=darkred]
                > >>
                > >>
                > >> domain.
                > >>
                > >>> --
                > >>> Ivo
                > >>
                > >>
                > >>
                > >> For most applications, the Location object - presumably due to its
                > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
                (just[color=blue][color=green][color=darkred]
                > >> like its .href property). You're comparing a relative url to a
                > >> fully-qualified one. Try:
                > >>
                > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
                -1)[color=blue][color=green][color=darkred]
                > >> {....
                > >>
                > >> Calling a String method so, you'll need that .href in this case.[/color]
                > >
                > >
                > > thank you very much Rob & Ivo for yr responses.. ok, after[/color][/color]
                following yr[color=blue][color=green]
                > > suggestion this is what I now have...
                > >
                > > <script language="JavaS cript" type="text/javascript">
                > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
                -1) {[color=blue][color=green]
                > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                > > alert(' ')
                > > document.write( " ")
                > > } else {
                > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                target="main">' )[color=blue][color=green]
                > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                width="138"[color=blue][color=green]
                > > height="24" border="0"></a></div>')
                > > }
                > > </script>
                > >
                > > alert pops ok now, but: wben I switch to a file in that main frame[/color][/color]
                [color=blue][color=green]
                > > other than file mentioned in conditional cond. is still not met[/color][/color]
                (i.e.,[color=blue][color=green]
                > > that img/link still does not appear..)
                > >
                > > I also tried this:
                > >
                > > <script language="JavaS cript" type="text/javascript">
                > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                target="main">' )[color=blue][color=green]
                > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                width="138"[color=blue][color=green]
                > > height="24" border="0"></a></div>')
                > > }
                > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
                > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                target="main">' )[color=blue][color=green]
                > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                width="138"[color=blue][color=green]
                > > height="24" border="0"></a></div>')
                > > }
                > > </script>
                > >
                > > and got exact same result..
                > > this:
                > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
                > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                > >
                > > gave me an error on those '||'...... don't know what that's about[/color][/color]
                either..[color=blue][color=green]
                > >
                > > I don't understand why this is such a problem... I also use this
                > > (to make sure a certain file is loaded in a frame when I reload):
                > >
                > > function loc() {
                > > parent.frames.m ain.location = 'mediaselect.ht ml'
                > > }
                > >
                > > and call function in onload event handler in body tag.. and this[/color][/color]
                works[color=blue][color=green]
                > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
                frame[color=blue][color=green]
                > > such a problem? again, many thanks for yr help.. Frances[/color]
                >
                > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
                still[color=blue]
                > not working.. now I put everything in a function..
                >
                > function check() {
                > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                > alert('')
                > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                target="main">' )[color=blue]
                > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                width="138"[color=blue]
                > height="24" border="0"></a></div>')
                > }
                > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
                > alert('')
                > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                target="main">' )[color=blue]
                > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                width="138"[color=blue]
                > height="24" border="0"></a></div>')
                > }
                > }
                >
                > and call function in body of file.. (also tried calling function in
                > body tag.. (onload... etc...)
                >
                > <script language="JavaS cript" type="text/javascript">
                > check();
                > </script>
                >
                > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
                I[color=blue]
                > want does not appear... I want it to appear if either of these two
                > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
                > don't want it to appear..) again, thank you for your help.. Frances[/color]

                Can't call document.write( ) on a loaded document as it discards the
                current one, although it may appear to be successful in some browsers.
                Try including that div in the original page and setting its .innerHTML
                property (document.getEl ementById('sel' ).innerHTML) to the link/img
                HTML string you need.

                Comment

                • RobB

                  #9
                  Re: checking for what file loaded in a frame..

                  Frances Del Rio wrote:[color=blue]
                  > Frances Del Rio wrote:
                  >[color=green]
                  > >
                  > >
                  > > RobB wrote:
                  > >[color=darkred]
                  > >> Ivo wrote:
                  > >>
                  > >>> "Frances Del Rio" wrote
                  > >>>
                  > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
                  > >>>>
                  > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
                  is[color=blue][color=green][color=darkred]
                  > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
                  syntax,[color=blue][color=green][color=darkred]
                  > >>>> right?? I also put a test alert, but alert does not come up if
                  > >>
                  > >>
                  > >> file
                  > >>
                  > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
                  Frances[color=blue][color=green][color=darkred]
                  > >>>
                  > >>>
                  > >>> You don't want the location object, but its href property.
                  > >>> Try
                  > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                  > >>> or
                  > >>> alert( parent.frames.m ain.location.hr ef );
                  > >>> first perhaps.
                  > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
                  restriction[color=blue][color=green][color=darkred]
                  > >>
                  > >>
                  > >> errors
                  > >>
                  > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
                  another[color=blue][color=green][color=darkred]
                  > >>
                  > >>
                  > >> domain.
                  > >>
                  > >>> --
                  > >>> Ivo
                  > >>
                  > >>
                  > >>
                  > >> For most applications, the Location object - presumably due to its
                  > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
                  (just[color=blue][color=green][color=darkred]
                  > >> like its .href property). You're comparing a relative url to a
                  > >> fully-qualified one. Try:
                  > >>
                  > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
                  -1)[color=blue][color=green][color=darkred]
                  > >> {....
                  > >>
                  > >> Calling a String method so, you'll need that .href in this case.[/color]
                  > >
                  > >
                  > > thank you very much Rob & Ivo for yr responses.. ok, after[/color][/color]
                  following yr[color=blue][color=green]
                  > > suggestion this is what I now have...
                  > >
                  > > <script language="JavaS cript" type="text/javascript">
                  > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
                  -1) {[color=blue][color=green]
                  > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                  > > alert(' ')
                  > > document.write( " ")
                  > > } else {
                  > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                  target="main">' )[color=blue][color=green]
                  > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                  width="138"[color=blue][color=green]
                  > > height="24" border="0"></a></div>')
                  > > }
                  > > </script>
                  > >
                  > > alert pops ok now, but: wben I switch to a file in that main frame[/color][/color]
                  [color=blue][color=green]
                  > > other than file mentioned in conditional cond. is still not met[/color][/color]
                  (i.e.,[color=blue][color=green]
                  > > that img/link still does not appear..)
                  > >
                  > > I also tried this:
                  > >
                  > > <script language="JavaS cript" type="text/javascript">
                  > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                  > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                  target="main">' )[color=blue][color=green]
                  > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                  width="138"[color=blue][color=green]
                  > > height="24" border="0"></a></div>')
                  > > }
                  > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
                  > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                  target="main">' )[color=blue][color=green]
                  > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                  width="138"[color=blue][color=green]
                  > > height="24" border="0"></a></div>')
                  > > }
                  > > </script>
                  > >
                  > > and got exact same result..
                  > > this:
                  > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
                  > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                  > >
                  > > gave me an error on those '||'...... don't know what that's about[/color][/color]
                  either..[color=blue][color=green]
                  > >
                  > > I don't understand why this is such a problem... I also use this
                  > > (to make sure a certain file is loaded in a frame when I reload):
                  > >
                  > > function loc() {
                  > > parent.frames.m ain.location = 'mediaselect.ht ml'
                  > > }
                  > >
                  > > and call function in onload event handler in body tag.. and this[/color][/color]
                  works[color=blue][color=green]
                  > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
                  frame[color=blue][color=green]
                  > > such a problem? again, many thanks for yr help.. Frances[/color]
                  >
                  > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
                  still[color=blue]
                  > not working.. now I put everything in a function..
                  >
                  > function check() {
                  > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                  > alert('')
                  > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                  target="main">' )[color=blue]
                  > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                  width="138"[color=blue]
                  > height="24" border="0"></a></div>')
                  > }
                  > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
                  > alert('')
                  > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                  target="main">' )[color=blue]
                  > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                  width="138"[color=blue]
                  > height="24" border="0"></a></div>')
                  > }
                  > }
                  >
                  > and call function in body of file.. (also tried calling function in
                  > body tag.. (onload... etc...)
                  >
                  > <script language="JavaS cript" type="text/javascript">
                  > check();
                  > </script>
                  >
                  > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
                  I[color=blue]
                  > want does not appear... I want it to appear if either of these two
                  > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
                  > don't want it to appear..) again, thank you for your help.. Frances[/color]

                  Can't call document.write( ) on a loaded document as it discards the
                  current one, although it may appear to be successful in some browsers.
                  Try including that div in the original page and setting its .innerHTML
                  property (document.getEl ementById('sel' ).innerHTML) to the link/img
                  HTML string you need.

                  Comment

                  • RobB

                    #10
                    Re: checking for what file loaded in a frame..

                    Frances Del Rio wrote:[color=blue]
                    > Frances Del Rio wrote:
                    >[color=green]
                    > >
                    > >
                    > > RobB wrote:
                    > >[color=darkred]
                    > >> Ivo wrote:
                    > >>
                    > >>> "Frances Del Rio" wrote
                    > >>>
                    > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
                    > >>>>
                    > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
                    is[color=blue][color=green][color=darkred]
                    > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
                    syntax,[color=blue][color=green][color=darkred]
                    > >>>> right?? I also put a test alert, but alert does not come up if
                    > >>
                    > >>
                    > >> file
                    > >>
                    > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
                    Frances[color=blue][color=green][color=darkred]
                    > >>>
                    > >>>
                    > >>> You don't want the location object, but its href property.
                    > >>> Try
                    > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                    > >>> or
                    > >>> alert( parent.frames.m ain.location.hr ef );
                    > >>> first perhaps.
                    > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
                    restriction[color=blue][color=green][color=darkred]
                    > >>
                    > >>
                    > >> errors
                    > >>
                    > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
                    another[color=blue][color=green][color=darkred]
                    > >>
                    > >>
                    > >> domain.
                    > >>
                    > >>> --
                    > >>> Ivo
                    > >>
                    > >>
                    > >>
                    > >> For most applications, the Location object - presumably due to its
                    > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
                    (just[color=blue][color=green][color=darkred]
                    > >> like its .href property). You're comparing a relative url to a
                    > >> fully-qualified one. Try:
                    > >>
                    > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
                    -1)[color=blue][color=green][color=darkred]
                    > >> {....
                    > >>
                    > >> Calling a String method so, you'll need that .href in this case.[/color]
                    > >
                    > >
                    > > thank you very much Rob & Ivo for yr responses.. ok, after[/color][/color]
                    following yr[color=blue][color=green]
                    > > suggestion this is what I now have...
                    > >
                    > > <script language="JavaS cript" type="text/javascript">
                    > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
                    -1) {[color=blue][color=green]
                    > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                    > > alert(' ')
                    > > document.write( " ")
                    > > } else {
                    > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                    target="main">' )[color=blue][color=green]
                    > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                    width="138"[color=blue][color=green]
                    > > height="24" border="0"></a></div>')
                    > > }
                    > > </script>
                    > >
                    > > alert pops ok now, but: wben I switch to a file in that main frame[/color][/color]
                    [color=blue][color=green]
                    > > other than file mentioned in conditional cond. is still not met[/color][/color]
                    (i.e.,[color=blue][color=green]
                    > > that img/link still does not appear..)
                    > >
                    > > I also tried this:
                    > >
                    > > <script language="JavaS cript" type="text/javascript">
                    > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                    > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                    target="main">' )[color=blue][color=green]
                    > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                    width="138"[color=blue][color=green]
                    > > height="24" border="0"></a></div>')
                    > > }
                    > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
                    > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                    target="main">' )[color=blue][color=green]
                    > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                    width="138"[color=blue][color=green]
                    > > height="24" border="0"></a></div>')
                    > > }
                    > > </script>
                    > >
                    > > and got exact same result..
                    > > this:
                    > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
                    > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                    > >
                    > > gave me an error on those '||'...... don't know what that's about[/color][/color]
                    either..[color=blue][color=green]
                    > >
                    > > I don't understand why this is such a problem... I also use this
                    > > (to make sure a certain file is loaded in a frame when I reload):
                    > >
                    > > function loc() {
                    > > parent.frames.m ain.location = 'mediaselect.ht ml'
                    > > }
                    > >
                    > > and call function in onload event handler in body tag.. and this[/color][/color]
                    works[color=blue][color=green]
                    > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
                    frame[color=blue][color=green]
                    > > such a problem? again, many thanks for yr help.. Frances[/color]
                    >
                    > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
                    still[color=blue]
                    > not working.. now I put everything in a function..
                    >
                    > function check() {
                    > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                    > alert('')
                    > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                    target="main">' )[color=blue]
                    > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                    width="138"[color=blue]
                    > height="24" border="0"></a></div>')
                    > }
                    > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
                    > alert('')
                    > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                    target="main">' )[color=blue]
                    > document.write( '<img src="images/ch_media.jpg" name="selm"[/color]
                    width="138"[color=blue]
                    > height="24" border="0"></a></div>')
                    > }
                    > }
                    >
                    > and call function in body of file.. (also tried calling function in
                    > body tag.. (onload... etc...)
                    >
                    > <script language="JavaS cript" type="text/javascript">
                    > check();
                    > </script>
                    >
                    > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
                    I[color=blue]
                    > want does not appear... I want it to appear if either of these two
                    > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
                    > don't want it to appear..) again, thank you for your help.. Frances[/color]

                    Can't call document.write( ) on a loaded document as it discards the
                    current one, although it may appear to be successful in some browsers.
                    Try including that div in the original page and setting its .innerHTML
                    property (document.getEl ementById('sel' ).innerHTML) to the link/img
                    HTML string you need.

                    Comment

                    • Rob B

                      #11
                      Re: checking for what file loaded in a frame..



                      Frances Del Rio wrote:[color=blue]
                      > Frances Del Rio wrote:
                      >[color=green]
                      > >
                      > >
                      > > RobB wrote:
                      > >[color=darkred]
                      > >> Ivo wrote:
                      > >>
                      > >>> "Frances Del Rio" wrote
                      > >>>
                      > >>>> if (parent.frames. main.location == 'mediaselect.ht ml') {
                      > >>>>
                      > >>>> I have a very simple frameset, name of frame where I'm checking[/color][/color][/color]
                      is[color=blue][color=green][color=darkred]
                      > >>>> 'main'... why is this not working? I mean this is correct[/color][/color][/color]
                      syntax,[color=blue][color=green][color=darkred]
                      > >>>> right?? I also put a test alert, but alert does not come up if
                      > >>
                      > >>
                      > >> file
                      > >>
                      > >>>> I'm testing for is loaded in 'main' frame.. thank you..[/color][/color][/color]
                      Frances[color=blue][color=green][color=darkred]
                      > >>>
                      > >>>
                      > >>> You don't want the location object, but its href property.
                      > >>> Try
                      > >>> if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                      > >>> or
                      > >>> alert( parent.frames.m ain.location.hr ef );
                      > >>> first perhaps.
                      > >>> And beware that all sorts of nasty cross-domain security[/color][/color][/color]
                      restriction[color=blue][color=green][color=darkred]
                      > >>
                      > >>
                      > >> errors
                      > >>
                      > >>> happen if the main frame happens to contain a document from[/color][/color][/color]
                      another[color=blue][color=green][color=darkred]
                      > >>
                      > >>
                      > >> domain.
                      > >>
                      > >>> --
                      > >>> Ivo
                      > >>
                      > >>
                      > >>
                      > >> For most applications, the Location object - presumably due to its
                      > >> importance - can be both written to & read as if it were a string[/color][/color][/color]
                      (just[color=blue][color=green][color=darkred]
                      > >> like its .href property). You're comparing a relative url to a
                      > >> fully-qualified one. Try:
                      > >>
                      > >> if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color][/color]
                      -1)[color=blue][color=green][color=darkred]
                      > >> {....
                      > >>
                      > >> Calling a String method so, you'll need that .href in this case.[/color]
                      > >
                      > >
                      > > thank you very much Rob & Ivo for yr responses.. ok, after following[/color][/color]
                      yr[color=blue][color=green]
                      > > suggestion this is what I now have...
                      > >
                      > > <script language="JavaS cript" type="text/javascript">
                      > > if (parent.frames. main.location.h ref.search('med iaselect.html') >[/color][/color]
                      -1) {[color=blue][color=green]
                      > > // if (parent.frames. main.location.h ref == 'mediaselect.ht ml') {
                      > > alert(' ')
                      > > document.write( " ")
                      > > } else {
                      > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                      target="main">' )[color=blue][color=green]
                      > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                      width="138"[color=blue][color=green]
                      > > height="24" border="0"></a></div>')
                      > > }
                      > > </script>
                      > >
                      > > alert pops ok now, but: wben I switch to a file in that main frame
                      > > other than file mentioned in conditional cond. is still not met[/color][/color]
                      (i.e.,[color=blue][color=green]
                      > > that img/link still does not appear..)
                      > >
                      > > I also tried this:
                      > >
                      > > <script language="JavaS cript" type="text/javascript">
                      > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                      > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                      target="main">' )[color=blue][color=green]
                      > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                      width="138"[color=blue][color=green]
                      > > height="24" border="0"></a></div>')
                      > > }
                      > > if (parent.frames. main.location.h ref.search('wmp .html') > -1)
                      > > document.write( '<div id="sel"><a href="mediasele ct.html"[/color][/color]
                      target="main">' )[color=blue][color=green]
                      > > document.write( '<img src="images/ch_media.jpg" name="selm"[/color][/color]
                      width="138"[color=blue][color=green]
                      > > height="24" border="0"></a></div>')
                      > > }
                      > > </script>
                      > >
                      > > and got exact same result..
                      > > this:
                      > > if (parent.frames. main.location.h ref.search('aud io.html') > -1) ||
                      > > (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                      > >
                      > > gave me an error on those '||'...... don't know what that's about[/color][/color]
                      either..[color=blue][color=green]
                      > >
                      > > I don't understand why this is such a problem... I also use this
                      > > (to make sure a certain file is loaded in a frame when I reload):
                      > >
                      > > function loc() {
                      > > parent.frames.m ain.location = 'mediaselect.ht ml'
                      > > }
                      > >
                      > > and call function in onload event handler in body tag.. and this[/color][/color]
                      works[color=blue][color=green]
                      > > fine.. why is testing whether or not a certain file is loaded in a[/color][/color]
                      frame[color=blue][color=green]
                      > > such a problem? again, many thanks for yr help.. Frances[/color]
                      >
                      > ooopss.. had forgotten a '{'.. but even after correcting this it's[/color]
                      still[color=blue]
                      > not working.. now I put everything in a function..
                      >
                      > function check() {
                      > if (parent.frames. main.location.h ref.search('aud io.html') > -1) {
                      > alert('')
                      > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                      target="main">' )[color=blue]
                      > document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
                      > height="24" border="0"></a></div>')
                      > }
                      > if (parent.frames. main.location.h ref.search('wmp .html') > -1) {
                      > alert('')
                      > document.write( '<div id="sel"><a href="mediasele ct.html"[/color]
                      target="main">' )[color=blue]
                      > document.write( '<img src="images/ch_media.jpg" name="selm" width="138"
                      > height="24" border="0"></a></div>')
                      > }
                      > }
                      >
                      > and call function in body of file.. (also tried calling function in
                      > body tag.. (onload... etc...)
                      >
                      > <script language="JavaS cript" type="text/javascript">
                      > check();
                      > </script>
                      >
                      > I do get alert now, but if wmp.html or audio.html are loaded img/link[/color]
                      I[color=blue]
                      > want does not appear... I want it to appear if either of these two
                      > files are loaded in 'main' frame; is 'mediaselect.ht ml' is loaded I
                      > don't want it to appear..) again, thank you for your help.. Frances[/color]

                      Can't call document.write( ) on a loaded document as it discards the
                      current one, although it may appear to be successful in some browsers.
                      Try including that div in the original page and setting its .innerHTML
                      property (document.getEl ementById('sel' ).innerHTML) to the link/img HTML
                      string you need.

                      *** Sent via Developersdex http://www.developersdex.com ***
                      Don't just participate in USENET...get rewarded for it!

                      Comment

                      • Rob B

                        #12
                        Re: checking for what file loaded in a frame..



                        ....death to googlegroups !

                        *** Sent via Developersdex http://www.developersdex.com ***
                        Don't just participate in USENET...get rewarded for it!

                        Comment

                        • Dr John Stockton

                          #13
                          Re: checking for what file loaded in a frame..

                          JRS: In article <1103051324.795 783.7160@c13g20 00cwb.googlegro ups.com>,
                          dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang. javascript, RobB
                          <ferndoc9@hotma il.com> posted :
                          [color=blue]
                          >Lines: 169[/color]
                          [color=blue]
                          >Can't call document.write( ) on a loaded document as it discards the
                          >current one, although it may appear to be successful in some browsers.
                          >Try including that div in the original page and setting its .innerHTML
                          >property (document.getEl ementById('sel' ).innerHTML) to the link/img
                          >HTML string you need.[/color]

                          Please do not quote excessively; it wastes time and resources which are
                          not yours. FAQ 2.3 para 6 refers.

                          --
                          © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                          Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                          Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                          No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                          Comment

                          • RobB

                            #14
                            Re: checking for what file loaded in a frame..

                            Dr John Stockton wrote:[color=blue]
                            > JRS: In article[/color]
                            <1103051324.795 783.7160@c13g20 00cwb.googlegro ups.com>,[color=blue]
                            > dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang. javascript,[/color]
                            RobB[color=blue]
                            > <ferndoc9@hotma il.com> posted :
                            >[color=green]
                            > >Lines: 169[/color]
                            >[color=green]
                            > >Can't call document.write( ) on a loaded document as it discards the
                            > >current one, although it may appear to be successful in some[/color][/color]
                            browsers.[color=blue][color=green]
                            > >Try including that div in the original page and setting its[/color][/color]
                            ..innerHTML[color=blue][color=green]
                            > >property (document.getEl ementById('sel' ).innerHTML) to the link/img
                            > >HTML string you need.[/color]
                            >
                            > Please do not quote excessively; it wastes time and resources which[/color]
                            are[color=blue]
                            > not yours. FAQ 2.3 para 6 refers.
                            >
                            > --
                            > © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00[/color]
                            MIME ©[color=blue]
                            > Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi:[/color]
                            Usenet Q&A.[color=blue]
                            > Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage[/color]
                            of News.[color=blue]
                            > No Encoding. Quotes before replies. Snip well. Write clearly. Don't[/color]
                            Mail News.

                            Dr. John:

                            Hoped my other (OT) comment would be self-explanatory. Please contact
                            googlegroups w/all complaints. Have no idea what is amiss...

                            Rob

                            Comment

                            • Dr John Stockton

                              #15
                              Re: checking for what file loaded in a frame..

                              JRS: In article <1103227920.375 125.257580@z14g 2000cwz.googleg roups.com>
                              , dated Thu, 16 Dec 2004 12:12:00, seen in news:comp.lang. javascript,
                              RobB <ferndoc9@hotma il.com> posted :
                              [color=blue]
                              >Lines: 38[/color]
                              [color=blue]
                              >Dr John Stockton wrote:[color=green]
                              >> JRS: In article[/color]
                              ><1103051324.79 5783.7160@c13g2 000cwb.googlegr oups.com>,[color=green]
                              >> dated Tue, 14 Dec 2004 15:16:24, seen in news:comp.lang. javascript,[/color]
                              >RobB[color=green]
                              >> <ferndoc9@hotma il.com> posted :
                              >>[color=darkred]
                              >> >Lines: 169[/color][/color][/color]
                              [color=blue][color=green]
                              >> Please do not quote excessively; it wastes time and resources which[/color]
                              >are[color=green]
                              >> not yours. FAQ 2.3 para 6 refers.
                              >> ...[/color]
                              > News.
                              >
                              >Dr. John:
                              >
                              >Hoped my other (OT) comment would be self-explanatory. Please contact
                              >googlegroups w/all complaints. Have no idea what is amiss...[/color]

                              Please do not quote excessively; it wastes time and resources which
                              are not yours. FAQ 2.3 para 6 refers. Read it. Don't blame the
                              service you chose to use; if necessary, blame your choice of service.


                              By the way, we already have a RobX, for some X in [A, C..Z]; like is
                              easier for others if authors use real (or simulated real) names of
                              sufficient length.

                              --
                              © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME ©
                              Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
                              Web <URL:http://www.merlyn.demo n.co.uk/news-use.htm> : about usage of News.
                              No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.

                              Comment

                              Working...