找回密码
 加入
搜索
查看: 5818|回复: 8

[IE类操作] [已解决]请教这样的IE表单该如何赋值并提交?

  [复制链接]
发表于 2011-3-17 14:58:28 | 显示全部楼层 |阅读模式
本帖最后由 zyfzyj 于 2011-3-25 12:54 编辑

请教这样的IE表单该如何赋值并提交?


网页源文件:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-CN">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="/images/insidepage/style1/style.css" type="text/css">
<title>群卡网—中国最大的点卡批发平台->订单确认</title>
<SCRIPT language="javascript">
function MM_findObj(n, d) {
var p,i,x;if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() {
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}
</script>
<script language="javascript">
function egsafecodeclose()
{
        if (document.buycard.HInfo.value=='')
        {}
        else
        {
        //document.buycard.EGEDIT.CloseAll;
        EGSafeActivex.CloseAll;
        }
}
</script>
<body class="mainbg" onbeforeunload="egsafecodeclose();">
<div id="mainhearder"><span>您的位置:<a href="Mch_Hp.asp">直销商管理系统</a> >> 我要进货 >> 订单确认</span></div>
<div id="hearder"><span>订单确认</span></div>
<FORM METHOD=POST name="buycard" ACTION="BuyCard_Step3.asp">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
        <td class="tableleft">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table1">
                <tr>
                <td width="22%" class="tableleft1">商品名称:</td>
                <td width="78%" align="left" class="tableright1">腾讯-Q币按元直充_特价</td>
                </tr>
                <tr>
                <td class="tableleft1">商品类型:</td>
                <td align="left" class="tableright1"><font color=#FF0000>自动充值</font></td>
                </tr>
               
                <tr>
                <td class="tableleft1">购买单价:</td>
                <td align="left" class="tableright1"><span onmouseover="MM_showHideLayers('price','','show')" onmouseout="MM_showHideLayers('price','','hide')">鼠标移此</span> <span id="price" style="visibility: hidden;"><font color=#ff0000>¥0.900</font></span></td>
                </tr>
                <tr style="display:block;">
                <td class="tableleft1">赠送积分:</td>
                <td align="left" class="tableright1"><font color=#ff0000>0.00</font></td>
                </tr>
               
                <tr>
                <td class="tableleft1"><font color=#ff0000>QQ号码:</font></td>
                <td align="left" class="tableright1"><font color=#ff0000><strong>123456789</strong></font><input type="hidden" name="GameId" value="123456789"></td>
                </tr>
                <tr>
                <td class="tableleft1"><font color=#ff0000>充值数量:</font></td>
                <td align="left" class="tableright1"><font color=#ff0000><strong>1个Q币</strong></font><input type="hidden" name="BuyNumber" value="1"></td>
                </tr>
               
                <tr>
                <td class="tableleft1">计费方式:</td>
                <td align="left" class="tableright1"><strong>Q币充值</strong><input type="hidden" name="ChargeType" value="Q币充值"><input type="hidden" name="ChargeType1" value="1"></td>
                </tr>
               
                <tr>
                <td class="tableleft1">购卡备注:</td>
                <td align="left" class="tableright1"><textarea name="BuyCardNote" cols="45" rows="3" class="input1" readonly></textarea></td>
                </tr>
                <tr>
                <td class="tableleft1">卖玩家单价:</td>
                <td align="left" class="tableright1">¥1.00 元<input type="hidden" name="SalePrice" value="1.00"></td>
                </tr>
                <tr>
                <td class="tableleft1"><font color=#ff0000>应收金额:</font></td>
                <td align="left" class="tableright1"><font color=#ff0000><strong>¥1.00</strong></font> 元<input type="hidden" name="TotalMoney" value="1.00"></td>
                </tr>
               
                <tr>
                <td class="tableleft1"><font color=#0000ff>动态密宝:</font></td>
                <td align="left" class="tableright1"><input type='text' size='10' maxlength='6' name='SafePassword' class='input' tabindex="1"> <script>document.write("<img align=absMiddle id=mbkimg src='/include/RndMBK.asp?",Math.random(),"'>")</script></td>
                </tr>
               
                </table>
        </td>
        </tr>
</table>
<br>

<input type="hidden" name="ProductId" value="116">
<input type="hidden" name="HInfo">
<input name="submit" type="submit" class="button" value="确认购买"  tabindex="3"> <input name="goback" type="button" class="button" value="返回重填" onclick="javascript:location.href='BuyCard_Step1.asp?ProductId=116';" tabindex="4">
<br><br>
</form>
<div style="display:none;"><OBJECT classid="clsid:A1B156BD-2CD6-4E7C-9C64-CEB2B8C0A929" id="EGSafeActivex" codebase="/EGSafeCode.ocx" width=0 height=0 style="display:none;"></OBJECT></div>
<script>
document.buycard.HInfo.value=EGSafeActivex.GetALL;
</script>
</body>
</html>

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2011-3-18 09:00:49 | 显示全部楼层
各位大大帮帮我啊!
发表于 2011-3-18 23:33:27 | 显示全部楼层
先取下这个图片
再用个函数进行识别(论坛有识别的帖子,在源码区)
发表于 2011-3-19 01:12:27 | 显示全部楼层
本帖最后由 lynfr8 于 2011-3-19 01:13 编辑

回复 2# zyfzyj
#include <IE.au3>
$oIE = _IECreate (@ScriptDir&"\test.html")
_IELoadWait($oIE)
$oForm = _IEGetObjByid($oIE, "buycard")
$a = _IEGetObjByName($oForm, 'SafePassword')
_IEFormElementSetValue($a, '赋值')        
$b = _IEGetObjByName($oForm, 'submit')
_IEAction ($b, "click")



放在脚本同目录作测试用

至于图中的验证码识别还是比较简单的
搜搜阿福的验证码识别教程

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2011-3-19 15:02:08 | 显示全部楼层
谢谢lynfr8大大的解答,还有个问题想请大家帮下忙,我现在的问题是如何对脚本运行前就已经存在的IE表单进行赋值,也就是说我图片中的网页表单不是由_IECreate创建的网页,而是由人工手动操作打开的IE窗口,之后在使用AU3脚本对其赋值并提交,这样该如何来写??再次谢谢大大的帮助!
 楼主| 发表于 2011-3-20 14:42:06 | 显示全部楼层
请求各位大大帮帮忙,我刚学AU3属于菜鸟!
发表于 2011-3-20 14:46:57 | 显示全部楼层
回复 6# zyfzyj

_IEAttach即可达到楼主5楼所提的需求
借鉴:
    http://www.autoitx.com/forum.php ... 17&fromuid=1003
 楼主| 发表于 2011-3-20 15:05:29 | 显示全部楼层
非常感谢lynfr8大大的解答,问题已经解决,谢谢!!
发表于 2011-9-4 00:19:28 | 显示全部楼层
好啊.........!`非常好
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-14 14:03 , Processed in 0.088067 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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