dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: WebBrowser Question

  1. #1
    Join Date
    Nov 2002
    Location
    UK
    Posts
    41

    Post WebBrowser Question

    Hi,

    Can anyone tell me how to call a JavaScript function from a Visual Baisc event (_click). My JavaScript is part of an HTML form in a WebBrowser component in a VB application.

    I have accessed HTML textareas from VB using

    text1.text = document.all.textarea.value

    This is a VB declaration that uses the DOM.

    TIA


  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    I ama bit confuse on your question.
    I know that WebBrowser component embeds an HTML page in VB Forrm,hence if you have an event that is initiated on that html page is by default captured by vb.Now here is What I think you should do.

    in the form load sub of your vb form that has WebVrowser object on it

    initialise the WebBrowser object

    such as
    WebBrowser.Navigate htmlPagesURL

    A WebBrowser object has an event called
    DocumentComplete

    in this sub initialize the HTMLDocument object like this

    Dim html As IHTMLDocument2
    Set html = web.Document
    Set htmlDoc = html

    Once you have done this, then you have the ability to use htmlDoc with all the events that a web page generates
    onclick,onmouseover,onmousemove and so on.....

    I hope thats what you wanted to know, Good Luck either way.

    BTW,
    you'd be better off posting your question on some VB forum

    cheers

    Khalid

  3. #3
    Join Date
    Nov 2002
    Location
    UK
    Posts
    41
    Thanks for the help but the problem is solved.

    If you need to run a script in a webbrowser activeX component called webbrowser1 then the vb is;

    private sub cmdGetScript_click()

    WebBrowser1.Document.All("buttonname").onclick

    '(where onclick is one of the HTML events)

    end sub


    oh, I did post this on the VBforum but got no help there!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles