Click to See Complete Forum and Search --> : WebBrowser Question


Tricky123
12-29-2002, 03:51 AM
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

:confused:

khalidali63
12-30-2002, 09:32 AM
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

Tricky123
12-30-2002, 10:21 AM
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!!:(