|
-
Jun 7th, 2005, 03:15 PM
#1
Thread Starter
Junior Member
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
-
Jun 7th, 2005, 03:41 PM
#2
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
-
Jun 7th, 2005, 04:02 PM
#3
Thread Starter
Junior Member
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
-
Jun 7th, 2005, 04:08 PM
#4
Re: Little bug with window.open
 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.
-
Jun 7th, 2005, 04:18 PM
#5
Thread Starter
Junior Member
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!!
-
Jun 7th, 2005, 04:38 PM
#6
Re: Little bug with window.open
 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
-
Jun 7th, 2005, 04:44 PM
#7
Thread Starter
Junior Member
Re: Little bug with window.open
Must be something wrong on my comp cause it won't work!! AARRRgghhhh!!
-
Jun 7th, 2005, 04:57 PM
#8
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
-
Jun 7th, 2005, 05:33 PM
#9
Thread Starter
Junior Member
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!
-
Jun 7th, 2005, 05:44 PM
#10
Re: Little bug with window.open
 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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|