chook
05-05-2003, 05:37 AM
Any ideas anyone?
There are two possible URL's which users can use to enter my page. I want to set up one link on my page, which does two different things, depending on which URL the user initially entered through.
If the user entered via URL "A" then the link should say "Click ME!" and on click it should do this:
"javascript:void(top.location='https://www.blah.blah.cgi')"
If the user entered via URL "B" then the link should also say "Click ME!" but this time on click it should do this:
alert("Here is some text");
I've found this bit of code already which executes differently depending on the entry URL, but can't customise it for the two different events I want to happen onclick:
<!-- This script and many more are available online from -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
if (location.href.indexOf("come.to") != -1){
document.write("Thanks for visiting!");
}
else {
document.write("Our new address is http://come.to/......");
}
// End -->
</SCRIPT>
There are two possible URL's which users can use to enter my page. I want to set up one link on my page, which does two different things, depending on which URL the user initially entered through.
If the user entered via URL "A" then the link should say "Click ME!" and on click it should do this:
"javascript:void(top.location='https://www.blah.blah.cgi')"
If the user entered via URL "B" then the link should also say "Click ME!" but this time on click it should do this:
alert("Here is some text");
I've found this bit of code already which executes differently depending on the entry URL, but can't customise it for the two different events I want to happen onclick:
<!-- This script and many more are available online from -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
if (location.href.indexOf("come.to") != -1){
document.write("Thanks for visiting!");
}
else {
document.write("Our new address is http://come.to/......");
}
// End -->
</SCRIPT>