Javascript open link in same window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gil@ambry.com

    #1

    Javascript open link in same window

    I have a form that I would like to get the values entered on the page
    and go to a new page in the same window. I can make the code work to
    open a new window, but I need it to open in the same window. Any help
    would be greatly appreciated.

    Here is what I have:


    function pass_info() {

    var info = "";

    info += document.form2. productWeight.v alue;
    window.open("/page/shippingrates/calculate_shipp ing_before.asp"
    + "?" + "weight=" + info,");
    }

    I know that it is the window.open, but I have not figured out what I
    need to do to get it in the same window.

    Thanks

  • kaeli

    #2
    Re: Javascript open link in same window

    In article <1115832129.021 776.212810@z14g 2000cwz.googleg roups.com>,
    gil@ambry.com enlightened us with...[color=blue]
    >
    > I know that it is the window.open, but I have not figured out what I
    > need to do to get it in the same window.[/color]

    location.replac e or location.href, depending on whether you want it
    overwritten or not, respectively.

    --
    --
    ~kaeli~
    Murphy's Law #2000: If enough data is collected, anything
    may be proven by statistical methods.



    Comment

    • gil@ambry.com

      #3
      Re: Javascript open link in same window

      I do not want it overwritten, but location.href does not work.
      location.replac e works, but not what I need. Do you have any other
      ideas on what I can use.

      Thanks,

      Comment

      • askMe

        #4
        Re: Javascript open link in same window


        g...@ambry.com wrote:[color=blue]
        > I do not want it overwritten, but location.href does not work.
        > location.replac e works, but not what I need. Do you have any other
        > ideas on what I can use.
        >
        > Thanks,[/color]

        Have you tried using iframe for the window you want to replace?



        Comment

        • kaeli

          #5
          Re: Javascript open link in same window

          In article <1115847892.833 929.236030@g44g 2000cwa.googleg roups.com>,
          gil@ambry.com enlightened us with...[color=blue]
          > I do not want it overwritten, but location.href does not work.[/color]

          Clarify "does not work".
          What happens or doesn't happen?

          And if this is a frameset, say so.

          What happens (or doesn't happen) when you do the following:

          info += document.form2. productWeight.v alue;
          window.location .href = "/page/shippingrates/calculate_shipp ing_before.asp?
          weight=" + info;

          Note that word-wrap may split that into three lines when it should be two.

          If you get an error, post it.

          --
          --
          ~kaeli~
          A backward poet writes... inverse.



          Comment

          • Thomas 'PointedEars' Lahn

            #6
            Re: Javascript open link in same window

            gil@ambry.com wrote:
            [color=blue]
            > I do not want it overwritten, but location.href does not work.[/color]

            It works. Only your source code or the JavaScript Console
            can tell why it does not work for *you* *there*.
            [color=blue]
            > location.replac e works, but not what I need.[/color]

            It fulfills the requirement of "open in the same window", though.
            [color=blue]
            > Do you have any other ideas on what I can use.[/color]

            Do you have more code or error messages?


            PointedEars
            --
            A true translation needs neither omissions nor addings.
            It is its own content.
            -- me, 2003

            Comment

            Working...