[Javascript] location redirect

Grinwald, Uri UGrinwald at dynamic.ca
Fri Nov 19 09:57:53 CST 2004


Hello
 
I have a unique codign question and was wondering if there was a smarter
way of performing the task at hand.
I have a few links on my website that have URL whick take them to
external sites (opens new window)
 
I have been asked to create a pop up that informs the user that they are
leaving our site and then asks them if they want to proceed by clicking
OK or Cancel respectively.
 
The Cancel button closes the window with the following code:
 
<form><input type=button value="Cancel"
onClick="javascript:window.close();">
</form>
 
The OK button I have attached a function that offers them one more
chance (confirm box) that they can cancel out of before redirecting.
 
Here is the function:
function confirm_entry()
{
input_box=confirm("Are you sure you want to leave dundeeprecious.com
?");
if (input_box==true)
 
{ 
document.location.href =
"http://www.tse.com/HttpController?GetPage=QuotesViewPage&DetailedView=D
etailedPrices&Language=en&QuoteSymbol_1=dpm";
 
}
 
else
{
// Output when Cancel is clicked
window.close();
}
 
}
-->
</script>
 
My problem is that the initial page has actually three separate external
links so how can I change the code to take them to the correct link
based on the referrer URL?
 
Currently I would have to create three similiar pages and just change
the location.href code... there has to be an easier way right?
 
 
 
 
 
 
 
Uri Grinwald
Web Designer
Dynamic Mutual Funds
40 King Street West
55th Floor Scotia Plaza
Tel: 416 365-2437
Fax: 416 365-5602
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20041119/a59d51ce/attachment.htm>


More information about the Javascript mailing list