Results 1 to 10 of 10

Thread: Resolved Little bug with window.open

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Resolved Resolved Little bug with window.open

    I have a basic function that's supposed to reload the current page:

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    function refreshpage(type,strtemp)
    {
    window.open("testNT.asp?type="+type+"&strtemp="+strtemp,"_self","")
    }
    The problem I get is that the page reloads, but but not with the variables. If I change the target to _blank, it works perfectly....

    What is wrong with the _self target???

    Thanks in advance!!
    Last edited by Isengard; Jun 7th, 2005 at 05:48 PM. Reason: Resolved

  2. #2
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Little bug with window.open

    _self referes to this window, you need to use _blank because you are opening a new window

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Re: Little bug with window.open

    Hi sciguyryan, the problem is that I want to reload the current page, I don't want to open a new one... I have a page with the identical function and it works perfectly, that's why I don't understand why this one won't reload with the _self target.... Any idea??

    Thanks

  4. #4
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Little bug with window.open

    Quote Originally Posted by Isengard
    Hi sciguyryan, the problem is that I want to reload the current page, I don't want to open a new one... I have a page with the identical function and it works perfectly, that's why I don't understand why this one won't reload with the _self target.... Any idea??

    Thanks

    Hmm, I see.

    Try this:

    Code:
    function Refreshpage(Type, StrTemp){
        if (!(window.location.href.indexOf("?type=") > 0)){
            window.location.href = window.location.href + "?type=" + Type + "&strtemp=" + StrTemp
        }
    }
    That should take the page location and then add ?type=something&strtemp=Something

    Cheers,

    RyanJ
    Last edited by sciguyryan; Jun 7th, 2005 at 04:13 PM.
    My Blog.

    Ryan Jones.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Re: Little bug with window.open

    I'm lost here, it doesn't work either, I tried this:



    Code:
    alert(window.location.href + "?type=" + Type + "&strtemp=" + StrTemp)
    I see the exact url as it should be but still, it won't reload.... And as I said, I have another page with the same function using different variables that work

    I'll have a look at the other page, just in case I'm missing something here!

    Thanks for your help!!

  6. #6
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Little bug with window.open

    Quote Originally Posted by Isengard
    I'm lost here, it doesn't work either, I tried this:



    Code:
    alert(window.location.href + "?type=" + Type + "&strtemp=" + StrTemp)
    I see the exact url as it should be but still, it won't reload.... And as I said, I have another page with the same function using different variables that work

    I'll have a look at the other page, just in case I'm missing something here!

    Thanks for your help!!
    Try the function that I posted.

    It does work because I just tested it

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Re: Little bug with window.open

    Must be something wrong on my comp cause it won't work!! AARRRgghhhh!!

  8. #8
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Little bug with window.open

    Have a look here - It works fine.

    See if you are doing it the way I am

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    May 2003
    Posts
    27

    Re: Little bug with window.open

    It's working!! That's great!

    Stupid me, stupid me!!! I just found what was my mistake!!! What I'm doing is sending the variables from a listbox to the function, but.... BUT I enclosed the listbox inside a form tag!!!

    I just removed the tags and everything works fine!!

    Thanks a bunch for your help, it helped me look at other things!

  10. #10
    Frenzied Member sciguyryan's Avatar
    Join Date
    Sep 2003
    Location
    Wales
    Posts
    1,763

    Re: Little bug with window.open

    Quote Originally Posted by Isengard
    It's working!! That's great!

    Stupid me, stupid me!!! I just found what was my mistake!!! What I'm doing is sending the variables from a listbox to the function, but.... BUT I enclosed the listbox inside a form tag!!!

    I just removed the tags and everything works fine!!

    Thanks a bunch for your help, it helped me look at other things!

    Great glad to hear it worked

    If your question has been solved then please edit your origina post to include the green checkmark as its icon and add Resolved to the threads title

    Cheers,

    RyanJ
    My Blog.

    Ryan Jones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width