parent.location problem with MSIE

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

    parent.location problem with MSIE

    Hi all,

    I'm quite new to javascript. I'm using the following code:

    <a href="javascrip t: void(0)" OnClick="if(con firm('Are you sure you want
    to delete the following items? sv650.jpg,.'))
    parent.location ='index.php?opt ion=modulemanag er&module=11&su boption=show&su boption2=delete &ID3=,52&ID=21& gallerypage=1'; ">Delete
    selected items</a>

    Using Mozilla or Netscape (Linux or Windows), this works fine. Using
    MSIE, the new url is not loaded.

    Any ideas why this happens and any solution?

    much thanks in advance,

    Martin

  • Evertjan.

    #2
    Re: parent.location problem with MSIE

    Martin Herrman wrote on 10 nov 2003 in comp.lang.javas cript:[color=blue]
    > OnClick="if(con firm('......... .[/color]

    Do away with the "if". You need a fals/true return.

    <a href="javascrip t:void(0)"
    OnClick="return confirm('Do you want to delete these items?')"
    parent.location ='index.php?... .';">
    Delete
    </a>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Martin Herrman

      #3
      Re: parent.location problem with MSIE

      On Mon, 10 Nov 2003 10:46:49 +0000, Evertjan. wrote:
      [color=blue]
      > Do away with the "if". You need a fals/true return.
      >
      > <a href="javascrip t:void(0)"
      > OnClick="return confirm('Do you want to delete these items?')"
      > parent.location ='index.php?... .';">
      > Delete
      > </a>[/color]

      Stupid me. Thanks for your help!

      Comment

      • Stuart Palmer

        #4
        Re: parent.location problem with MSIE

        Martin, what error do you get? What is not happening?

        I have done:

        <script language="javas cript">
        function deletefile()
        {
        if(confirm('Are you sure you want to delete the following items?
        sv650.jpg,.'))
        {
        parent.location ='http:\/\/www.yahoo.com';
        return true;
        }
        else
        {
        return false;
        }
        }
        </script>

        <a href="javascrip t: void(0)" onmousedown="re turn(deletefile ());">Delete
        selected items</a>

        and this works in ie 5.5. The bast way is to create a function I think.

        Hope that helps.

        Stu

        "Martin Herrman" <m.herrman@stud ent.tue.nl> wrote in message
        news:pan.2003.1 1.10.10.24.03.3 33273@student.t ue.nl...[color=blue]
        > Hi all,
        >
        > I'm quite new to javascript. I'm using the following code:
        >
        > <a href="javascrip t: void(0)" OnClick="if(con firm('Are you sure you want
        > to delete the following items? sv650.jpg,.'))
        >[/color]
        parent.location ='index.php?opt ion=modulemanag er&module=11&su boption=show&su b
        option2=delete& ID3=,52&ID=21&g allerypage=1';" >Delete[color=blue]
        > selected items</a>
        >
        > Using Mozilla or Netscape (Linux or Windows), this works fine. Using
        > MSIE, the new url is not loaded.
        >
        > Any ideas why this happens and any solution?
        >
        > much thanks in advance,
        >
        > Martin
        >[/color]


        Comment

        • Evertjan.

          #5
          Re: parent.location problem with MSIE

          Martin Herrman wrote on 10 nov 2003 in comp.lang.javas cript:
          [color=blue]
          > On Mon, 10 Nov 2003 10:46:49 +0000, Evertjan. wrote:
          >[color=green]
          >> Do away with the "if". You need a fals/true return.
          >>
          >> <a href="javascrip t:void(0)"
          >> OnClick="return confirm('Do you want to delete these items?')"
          >> parent.location ='index.php?... .';">
          >> Delete
          >> </a>[/color]
          >
          > Stupid me. Thanks for your help![/color]

          On second view, I am partly wrong.

          This should work:

          <a href='index.php ?....' target="_parent "
          OnClick="return confirm('Do you want to delete these items?')">
          Delete
          </a>

          And this:

          <script>
          function checkifdelete() {
          if confirm('Do you want to delete these items?')
          parent.location .href='index.ph p?....';
          return false;
          }
          </script>
          <a href="#"
          OnClick="return checkifdelete() ;">
          Delete
          </a>

          In both cases the onclick should return something boolean.

          The javascript:void (0) is superfluous,
          because it will only be uselessly invoked if javascript is off.


          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)

          Comment

          Working...