Re: Access JavaApplet through DOM

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



THE ANSWER:

Ok so I was having a conversation with another programmer in the
office. I told him I knew how to execute a JavaScript function on a
web page hosted by IE's Web Browser control (shdocvw.dll), but I
didn't know how to access a child object on the page. My desktop
application is using this control to host a web page that contains a
JavaApplet. The JavaApplet exposes functions that can be executed by
JavaScript. For example, I can place the following code in the click
event of a button to zoom in on the image:

document.viewOne.zoomIn();

document is just that the parent object. viewOne is the child object
on the page which in this case is the ViewOne Pro Java Applet.
Finally, zoomIn() is a function of the applet that is exposed to
JavaScript. The goofy way to implement this would be to wrap the line
above in a Javascript function (ZoomDaPage) which I could later
execute with the line below:

Me.wbImageViewer.Document.parentWindow.execScript "ZoomDaPage();",
"JScript"

Then it hit me. Wait whit don't I just execute an inline / no name /
self executing function? Below is the answer:

Me.wbImageViewer.Document.parentWindow.execScript "(function()
{document.ViewONE.zoomIn();}());", "JScript"

JavaScript Inline functions will allow me complete control of a
rendered web page within my Web Browser object.

Now, you may have caught on that this is a VB6 desktop application but
my original question as about JavaScript. Trust me, this group would
have had a better shot at the answer than the legacy VB group.
.



Relevant Pages

  • Re: How do I access the child object?
    ... I told him I knew how to execute a JavaScript function on a ... didn't know how to access a child object on the page. ... The JavaApplet exposes functions that can be executed by ... execute with the line below: ...
    (comp.lang.javascript)
  • Re: More bollocks from biggots
    ... So if you choose to visit sites that execute JavaScript from "Who knows ... Google as the Google Mail HTML/Javascript does. ... javascript response stored in memory. ...
    (comp.os.vms)
  • Execute JavaScript in a Web Browser Control using VB6
    ... Browser Control? ... exposed by a JavaApplet using JavaScript. ... My question was how do I execute this line of code in VB6 using the ... implement JavaScript wrapper functions just for me and since this code ...
    (microsoft.public.vb.general.discussion)
  • Re: Misspelling Can Bite You
    ... I misspelled the name of the control variable for a switch. ... JavaScript was quite happy to execute the code. ... Barring `this' referring to a host object or `bar' being a specially ...
    (comp.lang.javascript)
  • Re: timer in front page
    ... One solution would be to use JavaScript to submit the form when the ... it would execute in 30 minutes. ... > WebPage with a timer. ... > you put a timer into the WebPage? ...
    (microsoft.public.frontpage.client)