Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting href info dynamically

    Can anyone let me know how can I get the href info dynamically

    I have 2 different webistes, just want to show those website urls dynamically


    <html>
    <body>
    <a href="http://www.yahoo.com" target="_blank">YAHOO</a>
    <a href="http://www.Google.com" target="_blank">Google</a>

    <script type="text/javascript">
    document.write(href url of yahoo);
    document.write('href url of google);
    </script>
    </body>
    </html>

    thanks for help in advance

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    Code:
    <html>
    <head>
    <script type="text/javascript">
    window.onload=function(){
    var links=document.links;
    var div=document.getElementById('mydiv');
    for(var i=0;i<links.length;i++)
     div.appendChild(document.createTextNode(links[i].href))
    }
    </script>
    </head>
    <body>
    <a href="http://www.yahoo.com" target="_blank">YAHOO</a>
    <a href="http://www.Google.com" target="_blank">Google</a>
    
    <div id="mydiv"></div>
    </body>
    </html>
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks abduraooft, now i can able to get the href info
    i have to tweek for my final resultset
    cool..this site is really helpful


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •