vb.net webbrowser中下拉列表框赋值的有关问题vb.net webbrowser中下拉列表框赋值的有关问题
vb.net webbrowser中下拉列表框赋值的问题
网页源码
select name= typeid id= typeid width= 80
option value= 0 选择主题分类 /option option value= 1 聊天 /option
option value= 2 灌水 /option
option value= 3 转载 /option
option value= 4 拍砖 /option
/select
以下方法...
vb.net webbrowser中下拉列
框赋值的有关问题
vb.net webbrowser中下拉列表框赋值的问题
网页源码
select name= typeid id= typeid width= 80
option value= 0 选择主题分类 /option option value= 1 聊天 /option
option value= 2 灌水 /option
option value= 3 转载 /option
option value= 4 拍砖 /option
/select
以下
都不行
方法一:WebBrowser1.Document.GetElementById( typeid ).SetAttribute( value , 灌水 )’不提示错误但值没变
方法二:WebBrowser1.Document.GetElementById( typeid ).SetAttribute( value , 2 )’
不提示错误但值没变
方法三:WebBrowser1.Document.All.Item( typeid ).SetAttribute( checked , checked )’
不提示错误但值没变
方法四:WebBrowser1.Navigate( javascript:document.getElementById('typeid').value = '2'; void(0); )’不提示错误但值没变
方法五:WebBrowser1.Document.GetElementsByTagName( typeid ).Item(1).selected = True‘提示错误“selected”不是“System.Windows.Forms.HtmlElement”的成员
方法六:Dim op = WebBrowser1.Document.CreateElement( option )
op.SetAttribute( value , 2 )
op.InnerHtml = 灌水
WebBrowser1.Document.GetElementById( typeid ).AppendChild(op)
不提示错误但值没变
方法七:WebBrowser1.Document.GetElementById( typeid ).value= 1 '看到网上很多人是
这么写的可搬到程序中就提示出错,value不是“System.Windows.Forms.HtmlElement”的
成员
我用的是vs2010,vb.net
参阅了大量资料对于文本框和文本域都可以赋值,可下拉列表,找到这些方法都改变不了值,
求高人指点啊
------解决方案--------------------------------------------------------
方法二:WebBrowser1.Document.GetElementById( typeid ).SetAttribute( value , 2 )
这 句我测试的环境中也能正常运行。
本文档为【vb.net webbrowser中下拉列表框赋值的有关问题】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。