关于ocx与html的问题?

xjbx
博客专家认证
2003-07-11 03:45:42
请教如何在ocx中创建HTML元素并将它们插入到页面而不是用“页面设计器”。我用了insertAdjacentHTM方法不行!
谢谢!
...全文
120 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
xjbx 2003-07-25
  • 打赏
  • 举报
回复
up
xjbx 2003-07-21
  • 打赏
  • 举报
回复
有人可以帮我么?
since1990 2003-07-20
  • 打赏
  • 举报
回复
up
xjbx 2003-07-20
  • 打赏
  • 举报
回复
我发现着方面的资料太少了,msdn也没给什么!

我是想用方法来写一个上传的控件!
xjbx 2003-07-19
  • 打赏
  • 举报
回复
我的代码是ocx中动态生成一个html的元素:file(就是用于上传文件的那个组件,点击“浏览”,选择文件),我的代码是这样写的:


Private Sub Command1_Click()
Dim inputname As String
Dim oDoc As HTMLDocument
Dim oFileInput As HTMLFormElement
Dim odiv As HTMLDivElement
Dim pathname As String
inputname = "name1"
Dim pathname As string

Set oDoc = New HTMLDocument
'生成一个file
Set oFileInput = oDoc.createElement("input")
oFileInput.setAttribute "name", inputname
oFileInput.setAttribute "id", inputname
oFileInput.setAttribute "type", "file"
oFileInput.outerHTML = "<input type='file' id='" + inputname + "' name='" + inputname + "' >"

'打开file
oFileInput.click
pathname=oFileInput.value
debug.print pathname
end sub


问题是:我在html里加载这个ocx后,单击“command1”后,没有任何的反应?当然也就得不到pathname的值。

另外:我引用的是“Microsoft HTML Object Library”,没有使用“页面设计器”。

请高手指点我的代码有什么问题?
since1990 2003-07-19
  • 打赏
  • 举报
回复
up
laodan 2003-07-19
  • 打赏
  • 举报
回复
帮你up
xjbx 2003-07-16
  • 打赏
  • 举报
回复
再up
xjbx 2003-07-15
  • 打赏
  • 举报
回复
up
xjbx 2003-07-14
  • 打赏
  • 举报
回复
其实我也是没办法才这样用的
Alicky 2003-07-14
  • 打赏
  • 举报
回复
html里好象不好用OCX
xjbx 2003-07-14
  • 打赏
  • 举报
回复
这个问题很难嚒?
bobob 2003-07-11
  • 打赏
  • 举报
回复
xuexi
Rozre 2003-07-11
  • 打赏
  • 举报
回复
学习
benxie 2003-07-11
  • 打赏
  • 举报
回复
gzing
xjbx 2003-07-11
  • 打赏
  • 举报
回复
就是在ocx中加载的时候,会在html页面生成一个页面元素,比如生成一个“<input type="file" name="file">”,就是说““<input type="file" name="file">”是由ocx生成的!
nik_Amis 2003-07-11
  • 打赏
  • 举报
回复
不明白你的意思
nik_Amis 2003-07-11
  • 打赏
  • 举报
回复
不明白你的意思哦
xjbx 2003-07-11
  • 打赏
  • 举报
回复
没人知道嚒 ?

7,762

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧