Results 1 to 2 of 2

Thread: Getting value of an HTML Element

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2009
    Posts
    435

    Getting value of an HTML Element

    HTML
    Code:
    <input type="text" id="id1" name="id1" value="myvalue" title="id1" >
    How would I get "myvalue"? I've tried using .InnerText/.InnerHTML, but neither work. Instead of "myvalue" it will return "".

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: Getting value of an HTML Element

    use GetElementById to get the Element ( eg: id1 ) & then GetAttribute to get it's value, like this...
    Code:
            '/// obviously putting your own browser's name where i have WebBrowser1.
            If Not WebBrowser1.Document Is Nothing Then
                MessageBox.Show(WebBrowser1.Document.GetElementById("id1").GetAttribute("value"))
            End If
    hope it helps
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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