找回密码
 加入
搜索
查看: 2690|回复: 2

[IE类操作] HTML <input> 标签的 type 属性无法更改?

[复制链接]
发表于 2013-1-13 19:29:29 | 显示全部楼层 |阅读模式
;~ #include <IE.au3>
$url = "http://hi.baidu.com/go/login"
$oIE = ObjCreate("InternetExplorer.Application")
$oIE.visible = 1
$oIE.navigate($url)
$oIE.height = @DesktopHeight
$oIE.width = @DesktopWidth
Do
        Sleep(10)
Until $oIE.readyState = 4
$oIE.document.getElementById('username').value = '测试'
$oIE.document.getElementById('password').value = '$20130113'
$oEles = $oIE.document.GetElementsByTagName("a")
For $oEle In $oEles
        If StringInStr($oEle.outerhtml, '<a class="qbutton button button-save data-need-verify autosubmit-button clearfix" href="###" data-needverify="click:notempty(username)|notempty(password)|notempty(?verifycode)|save">') Then ExitLoop
Next
$oEle.click()
Sleep(2000)
$oIE.navigate("http://hi.baidu.com/pub/show/createtext")
Sleep(1000)
$oIE.document.getElementById('title').value = '测试百度空间'
$oIE.document.getElementById('private').value = 0
$oEles = $oIE.document.getElementById('articlePub').document.GetElementsByTagName("input")
MsgBox(0, "1", $oEles.item(3).type)
$oEles.item(3).type = "text"
;~ 'HTML <input> 标签的 type 属性
MsgBox(0, "2", $oEles.item(3).type)
<FORM id=articlePub onsubmit="return false;" name=articlePub> 
...................
<INPUT id=tags name=tags type=hidden> <INPUT id=private name=private type=hidden> <INPUT id=content name=content type=hidden> </FORM>
表单的HTML源
如何更改INPUT id=content 的属性或者如何直接提交表单?
发表于 2013-1-14 19:18:25 | 显示全部楼层
第一个问题:可以,但要重新加载才能生效.参考_IEBodyWriteHTML
第二个问题:参考_IEFormSubmit
 楼主| 发表于 2013-1-14 21:53:42 | 显示全部楼层
第一个问题:可以,但要重新加载才能生效.参考_IEBodyWriteHTML
第二个问题:参考_IEFormSubmit
ceoguang 发表于 2013-1-14 19:18


1.使用_IEBodyWriteHTML单纯重写<input name="content" id="content" type="hidden"/>后,再刷新还是更改不了。
2.这个表单<form name="articlePub" id="articlePub" onsubmit="return false;">的action被隐藏了,并且onsubmit属性被设为"false",直接使用_IEFormSubmit是无效的。
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-26 23:59 , Processed in 0.082594 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表