You know when you click a link to view item in SharePoint list and when you click Close it goes back to the page you came from?
Or when you edit an item - clicking OK returns you the page you original came from?
Well, you may have noticed SharePoint does that by adding the "Source=" url query string parameter to the address, and uses it to knwo where to go after we user is done.
So, basically - you can use that to redirect the user anywhere you want after he finishes with the form you sent him to, but - what if you want it to automatically be set to the current page's address?
Of course you can hard code the page's address, but what about additional query string parameters, of multiple addresses to the same page (different host headers)?
There is an easier way - the way SharePoint adds the "Source" parameter -
simply add this bit to your a link in HTML:
so that your link will look like:
<a href="/Docs/Lists/Announcements/DispForm.aspx?ID=1" ONCLICK="GoToLink(this);return false;">view item</a>
The GoToLink will automatically add thye current page's address before navigating to the HREF you entered!