|
|
Question : Problems with ActiveX control "webBrowser"
|
|
Attempting to load a web page objects contents from within ACCESS DATABASE FORM.
within ACCESS FORM I inserted ActiveX Control called "Microsoft WebBrowser" and named it WebBrowser0
two buttons called:- openPage and getobjectvalue
and a TextBox called MyMessage
the code that sits behind them looks like this:-
' on clicking this button the WebBrowser window will load with the page Private Sub openPage_Click() Me!WebBrowser0.Navigate "http://localhost/objectpage.asp" End Sub
' once you have opened the web page clicking this button should achieve the result but I cant get it to work Private Sub Getobjectvalue_Click() ' Me!MyMessage = Me!WebBrowser0.Document.location ' this works ' Me!MyMessage = Me!WebBrowser0.Document.body.innerHTML ' this works Me!MyMessage = Me!WebBrowser0.Document.body.myObject.message 'this Fails
End Sub ....
Ok hope you are with me so far?
objectpage.asp looks like this! ........... <BSCRIPT">%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> http://www.w3.org/TR/html4/loose.dtd">
Untitled Document
Has the Object built? ()
................. (Yes I know there is no need for an ASP page but it will be when live)
Now the Question is How can I load MyMessage with the contents of MyObject.message (I managed to load it with "hello from a Form" with Me!MyMessage = Me!WebBrowser0.Document.myform1.myfield1.value
Any help would be greatly appreciated!
Phew!
|
Answer : Problems with ActiveX control "webBrowser"
|
|
The problem is that MyObject IS NOT an object. But you can run your javascript with a command :
call Me!WebBrowser0.Document.parentwindow.execscript("buildObject(""Your Message"");", "javascript")
D'Al
|
|
|
|