Important alert: (current site time 7/15/2013 1:12:49 PM EDT)
 

VB icon

a better go back link

Email
Submitted on: 1/21/2003 7:40:09 AM
By: lixlpixel  
Level: Beginner
User Rating: Unrated
Compatibility: JavaScript
Views: 12929
author picture
(About the author)
 
     gives your user the ability to see where they came from/will go back. instead of showing a plain 'go back' link is says 'go back to [the name of the last page minus the ext.]')
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: a better go back link
' Description:gives your user the ability to see where they came from/will go back.
instead of showing a plain 'go back' link is says 'go back to [the name of the last page minus the ext.]')
' By: lixlpixel
'
' Inputs:referrer url - if you go directly to a page with this code on it, it'll do nothing...
'
' Returns:link to go back
'
' Assumes:if you have more than 6 sublevels, just duplicate the last bits of code and add it to the end modified in the way you can see in the code.
'
' Side Effects:doesn't work well with PHP/CGI powered sites passing a lot of variables in the url.
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=3382&lngWId=14'for details.'**************************************

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var Site = document.referrer ;
var Page = Site.split(".");
var Site1 = Page[2] ;
var Page1 = Site1.split("/");
var Many = Page1.length
var Page2 = Site.split("/");
document.write("go back to ");
 if (Many == 1) {
document.write("<a href=");
document.write("http://"+Page2[2]+">");
document.write(Page2[2]+"</a>");
}
 if (Many == 2) {
document.write("<a href=");
document.write("http://"+Page2[2]+"/"+Page2[3]+">");
document.write(Page1[1] + "</a>");
}
 if (Many == 3) {
document.write("<a href=");
document.write("http://"+Page2[2]+"/"+Page2[3]+"/"+Page2[4]+">");
document.write(Page1[2] + "</a>");
}
 if (Many == 4) {
document.write("<a href=");
document.write("http://"+Page2[2]+"/"+Page2[3]+"/"+Page2[4]+"/"+Page2[5]+">");
document.write(Page1[3] + "</a>");
}
 if (Many == 5) {
document.write("<a href=");
document.write("http://"+Page2[2]+"/"+Page2[3]+"/"+Page2[4]+"/"+Page2[5]+"/"+Page2[6]+">");
document.write(Page1[4] + "</a>");
}
 if (Many == 6) {
document.write("<a href=");
document.write("http://"+Page2[2]+"/"+Page2[3]+"/"+Page2[4]+"/"+Page2[5]+"/"+Page2[6]+"/"+Page2[7]+">");
document.write(Page1[5] + "</a>");
}
// End -->
</SCRIPT>


Other 1 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/3/2003 11:45:55 AM

Very nice idea.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.