Link to home
Start Free TrialLog in
Avatar of Lionheart2010
Lionheart2010

asked on

call / run / execute a javascript function on a html webpage with an vb 6 activeX on the same page

I've made a small vb6 activex control which resides on a webpage.
The webpage also got a Javascript.
What code in the VB6 activex component is needed to call / execute the
HelloWorld Javascript below?

Sample code:
<HTML>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function hello()
{
alert ("Hello world");
}
//-->
</SCRIPT>
</head>

<BODY>
<OBJECT id="myvbcomp" name="test1" classid="clsid:758D9CAB-04FE-49BF-AD81-886234C88189"> </OBJECT>

<A HREF="JavaScript:hello()">Hellolink on webpage</A>

</BODY>
</HTML>

/ Thanks
Avatar of Maheshwar R
Maheshwar R
Flag of India image

put a button and assign an onclick event.. or Try the following code..


<HTML>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function hello()
{
alert ("Hello world");
}
//-->
</SCRIPT>
</head>

<BODY>
<OBJECT id="myvbcomp" name="test1" classid="clsid:758D9CAB-04FE-49BF-AD81-886234C88189"> </OBJECT>

<A HREF="JavaScript:hello()">Hellolink on webpage</A>
<input id="Button1" type="button" value="button" onclick="return hello()" />
</BODY>
</HTML>

surely it works..
Avatar of Lionheart2010
Lionheart2010

ASKER

Your suggestion only adds a button to the webpage.
My question is how I call / run / execute / start / activate the Javascript function FROM the Visual Basic Component on the same page ( the <Object> )
I can put a button on the VB6 component, but it must be Visual Basic code to, not HTML.

Any more ideas?

/ Richard
ASKER CERTIFIED SOLUTION
Avatar of Niversoft
Niversoft
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Niversoft's suggestion on my other question solved this issue as well. THANKS!