473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Link with 2 functions - depending on reference page

6
Hi.
I need to make a link on various pages with 2 functions.
One that just act like browser-goback if vistor entered from a list-page.
And an ordinay linkfunction (where visitor will enter at the top) when reference page is any other than the list-page.

Have tried with this script
Expand|Select|Wrap|Line Numbers
  1.   function mylist()
  2. {   if(document.referrer === "list-page.htm"){
  3.             history.back();
  4.         } else {
  5.             document.location = "list-page.htm"
  6.         } }
  7.  
with link:
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:void(0)" onClick="return mylist()"</a>
It doesn´t work. Can anyone come up with a code that could do it, I would be really happy.
Aug 24 '15 #1
2 1188
Dormilich
8,658 Expert Mod 8TB
your link is completely invalid.

better go along
Expand|Select|Wrap|Line Numbers
  1. <span class="link">back</span>
and use the class to style it as link as well as attaching the click event.
Aug 24 '15 #2
Kaster
6
Yes, sorry I misssed a >
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:void(0)" onClick="return mylist()"></a>
The link normally works and is class styled as you propose with an image.
Aug 24 '15 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: crhaynes | last post by:
I'm having trouble with my CSS. My links are black, my hover is orange and my active link is red. When I select a link it turns red but i does not retain that color when the selected page loads. ...
33
by: STILL LEARNING | last post by:
I'm not sure if this can even be done, but what prompts the question is my desire to be able to create an "Uber Link" script/code of some sort, such that even if the html page contains nothing but...
0
by: joy0032 | last post by:
I want to place a link on a wap page to download a zip file to the mobile device. The page would be accessed by the device user and on clicking on the link the zip file should be downloaded to the...
1
by: m.n.summerfield | last post by:
Although a fan of Python, I find the Python Library Reference page (lib.html) very inconvenient because of its book contents-like layout. Also, some things that seem to me to belong together, such...
0
by: pandiyan.gpandi | last post by:
<link>Link Direct to Order Page</link>javascript and html available http://www.jdoqocy.com/placeholder-2056041?target=_top&mouseover=N
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
4
lee123
by: lee123 | last post by:
how do you put a link to a web page in your code? i have a check box named Not listed if they click on this i would like to have an web link in there so they can view it. lee123
1
by: tariquetuku | last post by:
How to create a login and logout link in a php page which will affect the session variable? Any code available?
3
by: Micka1 | last post by:
How do I refresh an iframe from a link on the parent page? This button (posted by Marss on this forum) does exactly what I need. But I want this to happen from a link, not a button. The button...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.