How to find what link we have clicked?
I my application i am having three links, on clickin开发者_JAVA百科g the link i need to find which link has been clicked and need to pass some unique information to the next page.
Kindly help
Like this <a href="/newpage?some_key=somevalue">link</a>
You'll need to query the parameters on the receiving page, though you could also use a target '#data' and query that.
This site has an example implementation of reading URL parameters
It would be good if you could clarify this a bit. Because there are many ways if solving this without Javascript...
You can either add a paramater to the URL link that is clicked. For instance instead of:
<a href="about.php">About</a>
Use:
<a href="about.php?clicked=about">About</a>
Then simply use that value in using Javascript on the following page by using for instance this script: http://snipplr.com/view/799/get-url-variables/
If you are using a server-side scripting language like PHP you can pick up on what page refered to the page your on.
echo $_SERVER['HTTP_REFERER']
There are more examples, just comment on this if you want me to give you more.
精彩评论