Results 1 to 5 of 5

Thread: [RESOLVED] Get Link Name

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Resolved [RESOLVED] Get Link Name

    Hi, I am using a webbrowser and the MS HTML Object library to add the links of a site to a listbox on my form. The problem is that I need to know what the text of the hyperlink is. I already know how to get the URL of the link with the HTML Object library but is there an easy way to get the text that it is linked with.
    eg:
    HTML Code:
    <a href="http://www.google.com">Google Is Here</a>
    I want to get the text "Google Is Here".
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Get Link Name

    Where would "Google is here" be coming from?

    Is this just static text that you want included with each link? Like if your link was www.vbforms.com the text would be "VBForums is here"?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Get Link Name

    No m8, I would need to parse it from the html so that I can have on my form a button that says "Google Is Here" or whatever the text on the link is and then when the user clicks it http://www.google.com will be opened or whatever the URL of the link is.
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  4. #4
    Lively Member BradBrening's Avatar
    Join Date
    Oct 2001
    Location
    Gillespie, IL
    Posts
    102

    Re: Get Link Name

    You can simply call the innerText or innerHTML for the link object.

    For example (I am going on memory here, forgive any syntax errors)

    VB Code:
    1. Dim I As Integer
    2. ' I don't remember if the document.links array is zero or one based.
    3. For I = 0 To document.links.length -1
    4.     Debug.Print document.links(I).innerText
    5.     Debug.Pring document.links(I).innerHTML
    6. Next

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Get Link Name

    wow, that worked brilliantly!
    Thanx a lot BradBrening, thread resolved!
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

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



Click Here to Expand Forum to Full Width