zangerbanger
05-14-2003, 12:12 AM
Has there ever been such thing as a link that you put on your website which automatically changes to whichever site you are surfing? If so, how do you do this?
*This is out of curiosity...*
angelivion
05-18-2003, 03:56 AM
Not that I've ever heard of it...
I doubt you're talking about banner exchange?
Stormx
05-19-2003, 06:41 PM
you could use history.go function, but i don't know how you could retrieve the URL. Thsi may or may not work. this assingns the variable "a" with the URL of th previos site:
a = history.go(1);
you could use a document.write command to display the info:
<script LANGUAGE="JavaScript" type="text/javascript>
a = history.go(1);
document.write("You last Surfed at " + a + "didn't you?");
</script>
You can include any HTML tags within the "" parts in the document.write part. Incase you were wondering the 1 part in the first part makes it go 1 back in the history, if you wanted to know the site b4 last then change it to 2 etc.
Mabey i'm some sort explainer-bot but i always give the clearest explainations i can
zangerbanger
05-19-2003, 07:54 PM
Thanks for all the help :) .
Stormx
05-19-2003, 08:24 PM
two errors in that script, and i added some extra stuff:
Errors
1.) Type didn't have " after it
2.) There wasn't a sapce after writing the "a" value
Added Stuff
1.) If the person has just opened a browser window to the site then a is undefined. I used if and else to fix this
<script LANGUAGE="JavaScript" type="text/javascript">
a = history.go(1);
if (a==undefined) {document.write("Aaaaahhhh. You opened a new window just for this site! I feel so loved!");}
else {document.write("You last Surfed at " + a + " didn't you?");}
</script>