Link to home
Start Free TrialLog in
Avatar of cheapstr
cheapstr

asked on

Hyperlink Question

Is it possible to have a link referenced to a variable? for example: i have an xml document with
<address> http:\\www.yahoo.com </address>  
<address> http:\\www.msn.com  </address>
etc.
Now instead of <a href="http:\\www.yahoo.com"> is there a way i can have <a href='contents of address field'>? I am trying to find a quick way to link hundreds of web addresses.
Avatar of Batalf
Batalf
Flag of United States of America image

You can give your <address> fields ids and use javascript to redirect to the text inside the address tag

example:

<html>
<address id="address1">http://www.yahoo.com</address>
<address id="address2">http://www.google.com</address>
<a href="#" onclick="location.href=document.getElementById('address1').innerHTML.replace(/\s/g,'');return false">Address 1</a>

ASKER CERTIFIED SOLUTION
Avatar of dougday
dougday

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial