VB ActiveX与JS交互

前端之家收集整理的这篇文章主要介绍了VB ActiveX与JS交互前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

一、js访问activex

VB:
--------------------------------
Public Property Let TxtVisible(ByVal New_TxtVisible As Boolean)
Text1.Visible = New_TxtVisible
PropertyChanged 'BlnSystemUser'
End Property

Public Sub SetValue1()
Text1.Text = "test zhanpeng"
End Sub
Public Sub SetValue2(str)
Text1.Text = str
End Sub
----------------------------------

JS:
---------------------------------
document.getElementById("obj").TxtVisible = false;
document.getElementById("obj").SetValue1();
document.getElementById("obj").SetValue2(44);
---------------------------------

二、activex访问js.txt

VB:
------------------------
Private Sub Command2_Click()
UserControl.Parent.Script.test (3)
End Sub
--------------------------

js:------------------------function test(str){alert(str);}------------------------

原文链接:https://www.f2er.com/vb/262836.html

猜你在找的VB相关文章