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!!
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
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
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
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 :sick:
I'll have a look at the other page, just in case I'm missing something here!
Thanks for your help!!
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 :sick:
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
Re: Little bug with window.open
Must be something wrong on my comp cause it won't work!! AARRRgghhhh!!
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
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! :D
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! :D
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