我的 代码不好用 请教 Dim IEList As New ShellWindows
Dim browser Private Sub Command1_Click()
On Error Resume Next
'遍历当前地浏览器窗口
For Each browser In IEList
'找到需要地IE窗口
If browser.Document.Title = "电子监控录入" Then
'获得浏览器地文档对象 browser.Document.All("uploadfile1").Value=text1
browser.Document.getElementById("uploadfile2").Value=text2 ’不能赋值 为何
End If
Text3 = browser.Document.All("uploadfile1").Value '能得到值
Text4 = browser.Document.getElementById("uploadfile2").Value' Next
End Sub
Dim browser Private Sub Command1_Click()
On Error Resume Next
'遍历当前地浏览器窗口
For Each browser In IEList
'找到需要地IE窗口
If browser.Document.Title = "电子监控录入" Then
'获得浏览器地文档对象 browser.Document.All("uploadfile1").Value=text1
browser.Document.getElementById("uploadfile2").Value=text2 ’不能赋值 为何
End If
Text3 = browser.Document.All("uploadfile1").Value '能得到值
Text4 = browser.Document.getElementById("uploadfile2").Value' Next
End Sub
<td><form name="form_tpxs1" enctype="multipart/form-data" method="post" target="paramIframe" action="servlet/SavePic">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="list_body_out" align=center><a href="####" onclick="pic_show(1)"><img name="tpxs1" src="theme/blue/nophoto.jpg" border="0" width="170" height="240" /></a>
<input type="hidden" name="xh" value="1234567890123456"/>
<input type="hidden" name="id" value="1"/>
</td>
</tr>
<tr class="list_body_out">
<td class="list_body_out">图片:<input type="file" name="uploadfile1" onchange="getFileName('1')" class="text_12" style="width:192" /></td>
</tr>
</table>
</form> </td>
<td><form name="form_tpxs2" enctype="multipart/form-data" method="post" target="paramIframe" action="servlet/SavePic"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr class="list_body_out">
<td class="list_body_out" align=center><a href="####" onclick="pic_show(2)"><img name="tpxs2" src="theme/blue/nophoto.jpg" border="0" width="170" height="240" /></a>
<input type="hidden" name="xh" value="1234567890123456"/>
<input type="hidden" name="id" value="2"/>
</td>
</tr>
这是网页源码
<td class="list_body_out">图片:<input type="file" name="uploadfile2" onchange="getFileName('2')" class="text_12" style="width:192" /></td>
</tr> 少发了一段
browser.Document.getElementsByName("uploadfile2")(0).Value=text2或
browser.Document.All("uploadfile2").Value=text2