Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confirm Function Page Navigation 2

Status
Not open for further replies.

FrankieNASCAR

Programmer
Apr 22, 2005
5
US
Hi All,
I have been wrestling with this issue long enough to make me post a question. First, here's my code:

Code:
function chkreg(lesson){
// asking user if they want to register
if(confirm("You are invited to signup for the free newsletter" +
  "\n " +
   "\nClick 'OK' to register or click 'CANCEL' to return to lesson plan")){
[b]window.open("/Reg/News/Signup/NewsSignup.asp");[/b]
}else{
  if(lesson == "E"){
    window.open("page1.pdf");
	}
  else if(lesson == "M"){
    window.open("page2.pdf");
	}
  else if(lesson == "G"){
    window.open("page3.pdf");
 }
 }
}
document.close();

In the top part of the function(bold line), is there another "window.XXXXX" property I can use to navigate to another asp page within my current browser window, as well as pass a value (like a querystring?) so I'll know what page I came from? The current code opens a new browser window, which I do not want. Thanks in advance for your time and help on this.

Frank
 
Frankie,

Instead of window.open, use window.href or location.href; that will change the URL of the current window that you're in.

Greg
 
To add to Greg's post, and answer your query about passing the referring page, you could do something like this:

Code:
window.location = '/Reg/News/Signup/NewsSignup.asp?referringPage=' + escape(window.location);

Hope this helps,
Dan





Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
You guys rock! I was able to combine your suggestions and it works like a charm. Thanks again!

Frank
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top