//这是我的Vb编写的ActiveX
Public Property Get Name() As Variant
End PropertyPublic Property Let Name(ByVal vNewValue As Variant)
txtName.Text = vNewValue
End PropertyPublic Sub SetValue1()
txtName.Text = "test zhanpeng"
End SubPrivate Sub Command1_Click()
txtName.Text = "kkskdksdk"End SubPrivate Sub UserControl_Initialize()End Sub//page 页面<head runat="server">
<title>无标题页</title>
<script language ="javascript" type ="text/javascript" >
function test()
{
document.getElementById("UserControl1").Name="zhanpeng";
debugger();
var obj1 = document.getElementById("UserControl1");
//这样做为什么不行呢
obj1.SetValue1();
// document.getElementById("UserControl1").SetValue()
//Project1.SetValue()
}
</script>
</head>
<body>
<OBJECT ID="UserControl1"
CLASSID="CLSID:00C6BC85-A6C8-416F-8D21-0ECCD4A619D1"
CODEBASE="Project1.CAB#version=1,0,0,0">
</OBJECT>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick ="test()" />
<input id="Button2" type="button" value="button" onclick ="test();"/>
</div>
</form>
</body>
我也打包了,如果是调用属性的话,一切ok
调用方法就出现了一些问题
Public Property Get Name() As Variant
End PropertyPublic Property Let Name(ByVal vNewValue As Variant)
txtName.Text = vNewValue
End PropertyPublic Sub SetValue1()
txtName.Text = "test zhanpeng"
End SubPrivate Sub Command1_Click()
txtName.Text = "kkskdksdk"End SubPrivate Sub UserControl_Initialize()End Sub//page 页面<head runat="server">
<title>无标题页</title>
<script language ="javascript" type ="text/javascript" >
function test()
{
document.getElementById("UserControl1").Name="zhanpeng";
debugger();
var obj1 = document.getElementById("UserControl1");
//这样做为什么不行呢
obj1.SetValue1();
// document.getElementById("UserControl1").SetValue()
//Project1.SetValue()
}
</script>
</head>
<body>
<OBJECT ID="UserControl1"
CLASSID="CLSID:00C6BC85-A6C8-416F-8D21-0ECCD4A619D1"
CODEBASE="Project1.CAB#version=1,0,0,0">
</OBJECT>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick ="test()" />
<input id="Button2" type="button" value="button" onclick ="test();"/>
</div>
</form>
</body>
我也打包了,如果是调用属性的话,一切ok
调用方法就出现了一些问题
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货