找回密码
 加入
搜索
查看: 5323|回复: 6

[IE类操作] [已解决]autoit如何对js按钮实现点击

  [复制链接]
发表于 2011-12-12 16:03:53 | 显示全部楼层 |阅读模式
本帖最后由 彼岸天堂 于 2011-12-19 11:33 编辑

Hi,大家好!最近在写IE脚本时遇到一个问题,由于本人接触autoit时间不长,无法实现对js按钮的点击,还请大神多多指教!
要点击的按钮源代码:
<html>
<head>
<lm:msg/>
<title>XXXXXXXX</title>
<META HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/nbWeb/css/menu.css" rel="stylesheet" type="text/css">
<style type="text/css"> 
body {
        background:        #FFFFFF;
        font-family: Arial, "Times New Roman", Times, serif;
        font-size: 10pt;
        border:                0;
        margin:                0;
        overflow:        hidden;
}
html {
        border:        0;
        overflow:        hidden;
}
.menu-bar {
        border-bottom:        2px groove;
}
.warning {
        color:        red;
}
a:link {
        color: #0257CC;
        text-decoration: none;
}
 
a:visited {
        color: #0257CC;
        text-decoration: none;
}
 
a:hover {
        color: red;
        text-decoration: none;
}
 
a:active {
        color: red;
        text-decoration: none;
}
</style>
 
<script type="text/javascript" src="/nbWeb/js/poslib.js"></script>
<script type="text/javascript" src="/nbWeb/js/scrollbutton.js"></script>
<script type="text/javascript" src="/nbWeb/js/menu.js"></script>
<script type="text/javascript" src="/nbWeb/js/public.js"></script>
</head>
 
<body>
<div align="center"><img width="100%" height="80" align="middle" src="images/BusinessTitle.jpg"></div>
<script type="text/javascript"> 
Menu.prototype.cssFile = "/nbWeb/css/menu.css";
Menu.prototype.mouseHoverDisabled = false;
 
 
 
 
 
var tmpItem;
var M1 = new MenuBar();
var M111 = new Menu();
var M11103 = new Menu();
M11103.add( tmpItem =new MenuItem('日终处理' ,'management/duizhang/duizhang.jsp?func_id=1110321' ));
tmpItem.target="main";
M11103.add( tmpItem =new MenuItem(' 系统对帐' ,'management/duizhang/dzcl.jsp?func_id=1110322' ));
tmpItem.target="main";
M11103.add( tmpItem =new MenuItem('对账结果查询' ,'management/duizhang/dz_jg_main.jsp?func_id=1110323' ));
tmpItem.target="main";
M111.add(new MenuItem('系统管理', null,null, M11103 ) );
M1.add( tmp = new MenuButton( "管理",M111 ));
M1.write();
</script>
<div id="div_style" style="position:absolute; left:0 px; top:0 px; width: 700 px; height:80 px; background-color:#FFCC00; filter:alpha(opacity=80); visibility:visible;">
<IFRAME id="iMsg" name="iMsg" height="80 px" width="700 px" border=0 framespacing=0 frameborder=0 src="/nbWeb/common/help.jsp"></IFRAME>
</div>
</body>
<script language='javascript'> 
   var sIDS=document.getElementById("div_style");
   var wth=sIDS.style.width;
   var w_v=wth.substring(0,wth.length-2);
   
   sIDS.style.left=(screen.width-w_v) +'px';
   
   function changeStyle(obj){
         var pulg = obj.value;
                 if(pulg=="信息开"){
               obj.value="信息关";
                 }else {
               obj.value="信息开";
                 }
         var sIDS=document.getElementById("div_style");
     
         var vu=form1.styleVu.value;
         if(vu=="block"){
           sIDS.style.display="none";
           form1.styleVu.value="none";
         }else if(vu=="none"){
           sIDS.style.display="block";
           form1.styleVu.value="block";
           form1.action="/nbWeb/common/help.jsp";
           form1.submit();
         }
   }
   
   function removeMsg(){
            iMsg.removeMsg();
   }
</script>
<form  name="form1" target="iMsg" action="/nbWeb/common/help.jsp">
<input type="hidden" name="styleVu"  value="block">
</form>
</html>
<script language="javascript"> 
//重载,add by zhonggc,20070814
MenuItem.prototype.dispatchAction = function () {
 
//获得代理,add by zhonggc,20070814
 var agent=parent.frames['userinfo'].getMyagent();
        if ( this.disabled )
                return;
 
        this.setSelected( true );
 
        if ( this.subMenu ) {
                if ( !this.subMenu.isShown() )
                        this.showSubMenu( false );
                return;
        }
 
        if ( typeof this.action == "function" ) {
                this.setSelected( false );
                this.parentMenu.closeAllMenus();
                this.action();
 
        }
        else if ( typeof this.action == "string" ) {        // href
 
                this.setSelected( false );
                this.parentMenu.closeAllMenus();
                if ( this.target != null ){
                        if(this.target == "blank") {
                                var        winWidth;
                                var        winHeight;
                                var        winFeatures;
                                winWidth=screen.width -10;
                                winHeight=screen.height - 80;
                                winFeatures="menubar=no,status=yes,toolbar=no,resizable=yes,titlebar=no,scrollbars=no,fullscreen=0,";
                                winFeatures+="top=0,left=0,height=" +winHeight + ",width=" + winWidth ;                                
                                blank = window.open( this.action, this.target, winFeatures);
                        } else {
                        if(agent[0]=="代理开"){
                          func=this.action.substring(this.action.indexOf("func_id=")+8);
                          //alert(agent[1]+";"+func);
                          if(agent[1].indexOf(func)==-1){
                           alert("代理用户没有此模块的权限!");
                           return ;
                          }
                        }
                                blank = window.open( this.action, this.target );
                        }
                }
                else{
                        document.location.href = this.action;
                }
        }
};
</script>
(我想点击的按钮为:管理-->系统管理-->系统对账)

本帖子中包含更多资源

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

×

评分

参与人数 1金钱 +1 收起 理由
afan + 1

查看全部评分

发表于 2011-12-12 18:37:32 | 显示全部楼层
可以试试用JQ 点击按钮..
;~ 将附件"jquery.min.js"放在脚本目录下
#include<IE.au3> 
Global $oIE = _IECreate("http://www.baidu.com")
js(FileRead("jquery.min.js"))
js("$('#kw').val('hello')")
js("$('#su').click()")

Func js($script)
    $oIE.document.parentWindow.execscript($script)
EndFunc

评分

参与人数 1金钱 +20 收起 理由
afan + 20

查看全部评分

发表于 2011-12-12 19:36:37 | 显示全部楼层
为什么一定要点击呢?知道网页地址可以直接_IENavigate打开网址实现....

当然有点击的方面我也期待可以学习学习
发表于 2012-2-19 19:44:53 | 显示全部楼层
这个真好~~~
发表于 2012-3-30 15:48:19 | 显示全部楼层
这个真好~~~
发表于 2012-10-24 11:25:10 | 显示全部楼层
不是很明白
发表于 2012-10-25 21:40:18 | 显示全部楼层
这种css方式显示的菜单的确是有点难啊,不过可以根据innerhtml的值来判断,进行点击。
if $ele.innerhtml="管理" then $ele.click
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-6-12 06:42 , Processed in 0.080607 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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