how to open a page(in the same browser window) when clicking

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

    #1

    how to open a page(in the same browser window) when clicking

    how do I open a page in the same browser window using onclick?

  • rovisoft

    #2
    re:how to open a page(in the same browser window) when clicking

    Try to use
    onclick="<scrip t>window.locati on='page.html'</script>";

    http://www.DevPlug.com --Connecting Developers
    Posted from: http://www.devplug.com/ftopic32129.htm

    Comment

    • Tim Roberts

      #3
      Re: how to open a page(in the same browser window) when clicking

      admin@devplug-dot-com.no-spam.invalid (rovisoft) wrote:[color=blue]
      >
      >Try to use
      >onclick="<scri pt>window.locat ion='page.html' </script>";[/color]

      The contents of an event handler are always Javascript, and the string
      "<script>" is a syntax error in Javascript. Do this instead:

      onClick="window .location='page .html'"
      --
      - Tim Roberts, timr@probo.com
      Providenza & Boekelheide, Inc.

      Comment

      • clod

        #4
        error

        i get the answer object does not support this action

        Comment

        • clod

          #5
          Re: how to open a page(in the same browser window) when clicking

          > Tim Robertswrote:
          admin@devplug-dot-com.no-spam.invalid (rovisoft) wrote:[color=blue]
          >
          > Try to use
          > onclick="<scrip t>window.locati on='page.html'</script>";
          >[/color]
          The contents of an event handler are always Javascript, and the
          string
          "<script>" is a syntax error in Javascript. Do this instead:

          onClick="window .location='page .html'"
          --
          - Tim Roberts, timr@probo.com
          Providenza & Boekelheide, Inc.[/quote:f07927e48 d]
          by doing that it will still open a new browser window, isn't there a
          way to keep it in the same window?

          Comment

          • Aaron Askew

            #6
            Re: how to open a page(in the same browser window) when clicking

            window.location =url shouldn't open a new window. It should change the
            current window's location.

            window.open() is used for opening new windows.

            Browsers can override these settings, however. Maybe an option is set
            to open all links in separate windows/tabs.

            -aaron

            Comment

            • Chung Leong

              #7
              Re: error

              LOL. Think before you post, people.

              It should be onclick="locati on.href = 'page.html'". Window.location is
              an object.

              If you want the new page to replace the current page in the history,
              use location.replac e(url).

              Comment

              • Tim Roberts

                #8
                Re: how to open a page(in the same browser window) when clicking

                randompeep2000@ yahoo-dot-com.no-spam.invalid (clod) wrote:[color=blue]
                > Tim Robertswrote:[color=green]
                >>
                >>The contents of an event handler are always Javascript, and the
                >>string "<script>" is a syntax error in Javascript. Do this instead:
                >>
                >> onClick="window .location='page .html'"[/color]
                >
                >by doing that it will still open a new browser window, isn't there a
                >way to keep it in the same window?[/color]

                In saying that, you are simply confirming that you didn't even try it.

                Assigning to window.location replaces the contents of the current browser
                window. It does not open a new one.
                --
                - Tim Roberts, timr@probo.com
                Providenza & Boekelheide, Inc.

                Comment

                Working...