Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Geting destination url2

Status
Not open for further replies.

darkling235

Programmer
Oct 30, 2006
24
US
Ok if I can't access the destination url where I'm going onleave, what about if I put a javascript function like onClick in each A href tag. Is there a way for me to get the actual URL in the link and do something with it before we redirect to the new page?

Like

<A href = "unspecified url" onClick = "GetUrlandDoSomethingWithIt"> Click Here <A href>

Can I get the "unspecified url" here in my GetUrlandDoSomethingWithIt method? Because this webapp is pretty complicated I will have no idea where the link actually goes. I need to find out at run time.
Thanks again
 
You could try something like:
Code:
<a href = "unspecified url" onClick = "GetUrlandDoSomethingWithIt(this.href); return false"> Click Here </a>

This wouldn't work in browsers with Javascript deactivated, though. You'd have to handle actually changing the page in the function by assigning the URL to location.href.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top