注册 登录
编程论坛 VB6论坛

求助 如何自动填写 网页表格信息 并自动登录

yuanyong911 发布于 2023-07-29 17:17, 1150 次点击
求助 如何自动填写 网页表格信息 并自动登录

我有一个 内部网页 想实现

通过 VB 的 WebBrowser1 控件 在 VB程序中 自动填写表格 并 登录

下面是我的代码 但 运行起来后 没有任何 效果。没有出现自动填写 表格的动作

只有本站会员才能查看附件,请 登录


Text1 = "zhangsan"
Text2 = "123456"


Dim d As Object, o As Object, pc As String
Set d = WebBrowser1.Document
   If d Is Nothing Then Exit Sub
   
    Set o = d.getElementById("userName")
    o.Value = Text1.Text
    Set o = d.getElementById("Pwd")
    o.Value = Text2.Text
   
    '点击登录按钮
    WebBrowser1.Document.parentWindow.execScript "login()"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

网页源码


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www. <html> <head> <meta http-equiv="Content-Type" content="text/html" charset="GBK"> <meta HTTP-EQUIV="pragma" CONTENT="no-cache"/> <meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate"/> <meta HTTP-EQUIV="expires" CONTENT="0"/> <LINK href="favicon.ico" type="image/x-icon" rel=icon> <LINK href="favicon.ico" type="image/x-icon" rel="shortcut icon"> <title>上网认证 | ePortal</title> <script language="javascript" type="text/javascript" src="http://10.2.0.34:8082/eportal/nodeDir/login_bch.js"></script> <style>html{height:100%;width:100%;}.blackBg{background-color:#333;}.blueBg{background-color:#4ea3da;}body{height:100%;width:100%;font-family:"Microsoft Yahei","微软雅黑",Arial,STHeiti;}*{margin:0;padding:0;}#loginForm{margin:0;padding:0;height:100%;width:100%;}#contentDive{margin:0;padding:0;height:100%;width:100%;overflow:hidden;position:relative;}a{text-decoration:none;outline:none;}select{height:30px;line-height:30px;font-size:19px;border:0;border:none;width:300px;background:#fff;}#login_table{width:250px;}#login_table td{margin:10px;}.loginLabel{font-family:"Microsoft Yahei";color:#fff;font-size:12px;font-weight:bold;text-align:right;width:24%;height:30px;}.loginTitle{height:15px;}.loginTitle img{width:150px;}#errorDiv{font-family:"Microsoft Yahei";font-size:12px;font-weight:300;width:95%;min-height:20px;line-height:20px;word-wrap:break-word;word-break:break-all;margin:0;padding:0;color:#db9d09;}#validcodeframe{background-color:#666;align:center;valign:middle;filter:Alpha(opacity = 40);opacity:.4;width:100%;position:absolute;top:0;height:100%;z-index:1000;}#validcodeDiv{z-index:1000;position:absolute;width:400px;height:164px;left:40%;top:40%;border:none;border-width:0;background-repeat:no-repeat;width:406px;height:171px;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/validcode.png);}#validcode_content{position:absolute;width:190;top:46px;left:210px;height:120px;font-size:14;font-weight:bolder;color:#767c8a;height:27px;line-height:27px;border:0;}#validcode_error{position:absolute;width:200;top:78px;left:200px;height:120px;font-size:14;font-weight:bolder;color:#767c8a;height:27px;min-height:27px;min-width:190px;line-height:27px;background-color:#fff;border:0;}#validcode_content input{border:none;border-width:0;}#validcode{margin:0;font-size:100%;padding:0;margin:0;padding:0;cursor:text;width:64px;height:20px;line-height:20px;}#validImage{width:80px;height:30px;cursor:hand;border:none;margin:0;padding:0;vertical-align:top;}#validcode_foot{width:100%;height:44px;}#validcode_foot div{height:40px;position:absolute;text-align:right;bottom:1px;right:15px;}#validcode_foot img{position:absolute;outline:none;bottom:6px;right:15px;border:0;text-align:center;}#xiaoxi_detail{position:absolute;z-index:1000;}.xiaoxi_touming{position:absolute;display:none;z-index:1000;}.xiaoxi_touming_show{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/div_bg.png);position:absolute;display:none;z-index:1000;}.xiaoxi_content{color:#fff;scrollbar-base-color:#f0f0f0;font-size:15px;z-index:1000;SCROLLBAR-FACE-COLOR:#555;SCROLLBAR-DARKSHADOW-COLOR:#555;SCROLLBAR-HIGHLIGHT-COLOR:#6c6c90;SCROLLBAR-SHADOW-COLOR:#666;SCROLLBAR-3DLIGHT-COLOR:#555;SCROLLBAR-ARROW-COLOR:#240024;SCROLLBAR-TRACK-COLOR:#fff;SCROLLBAR-BASE-COLOR:#555 word-wrap:break-word;word-break:break-all;overflow:auto;padding:2px;font-size:15px;}.slide{margin:0;padding:0;display:none;}.slide img{border:0;margin:0;padding:0;}#errorInfo{position:absolute;z-index:1000;min-height:28px;height:28px;display:none;}#errorInfo_left{background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -180px;min-width:6px;width:6px;min-height:28px;height:28px;position:absolute;}#errorInfo_center{background-repeat:repeat-x;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -210px;min-height:28px;height:28px;font-size:16pt;font-weight:bold;line-height:28px;color:red;position:absolute;}#errorInfo_right{min-width:19px;width:19px;min-height:28px;height:28px;position:absolute;}#errorInfo_right #right_bg{position:absolute;right:0;bottom:0;width:19px;height:35px;border:0;border-width:0;cursor:pointer;}#errorInfo_right #right_close{position:absolute;right:0;top:-7px;_top:0;width:13px;height:13px;border:0;border-width:0;cursor:pointer;}#loginFrame{position:absolute;z-index:1000;margin:0;padding:0;display:none;}#loginFrameLogo{position:absolute;top:25px;}#loginContent{position:absolute;height:auto;width:396px;left:110px;}#loginContent div{border:0;border-width:0;}.login_frame{position:relative;width:396px;top:0;vertical-align:bottom;}#loginFrameLogo{background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-300px 0;height:35px;width:107px;}.login_frame_top{background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -98px;height:9px;border-width:0;width:100%;}.login_frame_hang{vertical-align:bottom;position:relative;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -108px;left:0;height:30px;line-height:30px;overflow:hidden;width:100%;}.login_frame_hr{background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -168px;height:3px;border-width:0;width:100%;}.login_frame_bottom{background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -154px;height:9px;border-width:0;width:100%;}.left_right_input{position:relative;left:2px;right:2px;width:392px;}.left{float:left;position:relative;top:6px;width:28px;height:20px;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);}#username_left{background-position:-164px -74px;}#pwd_left{background-position:-190px -74px;}#service_left{background-position:-220px -76px;}#service_detail_left{background-position:-290px -76px;}#serviceShowHide{display:none;}.xiala{position:relative;float:right;right:5px;width:20px;height:20px;top:-20px;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-256px -76px;}.right{width:360px;float:left;}#service_div{vertical-align:bottom;position:relative;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -108px;left:0;height:30px;line-height:30px;width:100%;}#loginFrame .input{margin:0;font-size:100%;padding:0;margin:0;padding:0;cursor:text;border-width:0;border:none;height:30px;line-height:30px;width:360px;}#loginFrame .input_tip{margin:0;font-size:100%;color:#767c8a;padding:0;margin:0;padding:0;cursor:text;height:30px;border:none;border-width:0;line-height:30px;width:360px;display:none;}#login_btn{position:relative;width:396px;top:10px;}.SLoginBtn{height:31px;line-height:31px;}.SLoginBtn li{padding-left:2px;padding-right:2px;list-style-type:none;list-style-image:none;float:right;}.SLoginBtn li div{height:28px;cursor:pointer;font-size:90%;}.SLoginBtn .login_btn_left{float:left;}#loginLink div,#loginLink_out div{width:177px;height:31px;text-align:center;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:0 -38px;font-size:16px;color:#fff;font-weight:bold;}#loginLink_in div{width:177px;height:31px;text-align:center;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-180px -37px;font-size:16px;color:#ed8f2f;font-weight:bold;}#freshImage{font-size:12px;height:12px;line-height:12px;color:#000;vertical-align:top;}#loginForm select{font-style:normal;font-weight:normal;text-align:left;width:235px;}#foot_control{position:absolute;width:100%;z-index:1000;bottom:0;margin:0;padding:0;}#control{height:50px;margin:0;padding:0;display:none;}#foot{position:relative;margin:0;padding:0;color:#666;}#control ul{text-align:center;list-style-type:none;list-style-image:none;margin-right:50px;}#control ul li{float:right;margin:0;padding:0;margin-left:5px;display:inline;list-style-type:none;list-style-image:none;}#foot_content{top:5px;left:5px;position:absolute;}#foot ul li{float:left;margin:0;padding:0;display:inline;width:230px;list-style-type:none;list-style-image:none;}#foot ul li a{color:#7e7e7e;cursor:pointer;}#foot_content div{line-height:30px;font-size:12px;height:30px;font-weight:bold;}#foot_detail{position:absolute;bottom:;}.xinxi_leftImg{position:relative;top:5px;margin-right:5px;}#gonggaolan div,#yonghuxuzhi div,#xitongtongzhi div{float:left;}#gonggaolan .left_div{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-192px 0;width:25px;min-width:25px;height:100%;}.right_div{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-275px 0;width:14px;}.right_div_bai{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-285px 0;width:14px;}#yonghuxuzhi .left_div{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-220px 0;width:25px;min-width:25px;height:100%;}#xitongtongzhi .left_div{background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-250px 0;width:25px;min-width:25px;height:100%;}#head_gongneng{position:absolute;width:100%;z-index:1000;top:0;margin:0;padding:0;font-size:14px;font-weight:bold;margin-right:50px;color:#edebeb;width:100%;height:100%;}#autoLogin{bottom:15px;position:absolute;right:50px;display:none;}#autoLogin ul{text-align:center;list-style-type:none;list-style-image:none;}#autoLogin ul li{height:18px;line-height:18px;float:right;margin:0;padding:0;margin-left:4px;display:inline;list-style-type:none;list-style-image:none;}#autoLogin ul li a{color:#edebeb;}#is_auto_land_td{text-align:right;width:10%;}.full div{width:38px;height:38px;padding:0;border:0;cursor:pointer;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-40px 2px;}.prev div{width:38px;height:38px;padding:0;border:0;cursor:pointer;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-86px 0;}.next div{width:38px;height:38px;padding:0;border:0;cursor:pointer;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-134px 1px;}#registframe{background-color:#666;align:center;valign:middle;filter:Alpha(opacity = 40);opacity:.4;width:100%;position:absolute;top:0;height:100%;z-index:1000;display:none;}#registDiv{display:none;}.registDiv{z-index:1000;position:absolute;width:100%;height:400px;left:40%;top:40%;border:none;border-width:0;background-repeat:no-repeat;width:100%;height:500px;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/phoneRegister2.png);}#regist_validImage{cursor:hand;}#registDiv_content{position:absolute;width:100%;top:38px;left:140px;font-size:16;font-weight:bolder;color:#767c8a;border:0;}#registDiv_foot img{outline:none;border:0;text-align:center;}#registDiv_content input{font-size:12px;border:none;border-width:0;}#regist_validImage{padding-left:5px;vertical-align:text-bottom;height:19px;}#regist_validcode{width:107px;}#registerForSMS_result{position:absolute;width:320px;top:5px;left:45px;font_size:12px;text-align:center;}#registerNoForSMS_result{position:absolute;width:320px;top:5px;left:45px;font_size:12px;text-align:center;}#registOkId{padding-left:100px;}#registNoframe{background-color:#666;align:center;valign:middle;filter:Alpha(opacity = 40);opacity:.4;width:100%;position:absolute;top:0;height:100%;z-index:1000;display:none;}#registNoDiv{display:none;}.registNoDiv{z-index:1000;position:absolute;width:100%;height:400px;left:40%;top:40%;border:none;border-width:0;background-repeat:no-repeat;width:100%;height:500px;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/phoneRegister3.png);}#registnoshow_validImage{cursor:hand;}#registNoDiv_content{position:absolute;width:100%;top:39px;left:155px;font-size:15.5;font-weight:bolder;color:#767c8a;border:0;}#registNoDiv_foot img{outline:none;border:0;text-align:center;}#registNoDiv_content input{font-size:12px;border:none;border-width:0;}#registnoshow_validImage{padding-left:5px;vertical-align:text-bottom;height:19px;}#regist_validcode_sm{width:107px;}#registOkNoId{padding-left:100px;}#authorframe{background-color:#666;align:center;valign:middle;filter:Alpha(opacity = 40);opacity:.4;width:100%;position:absolute;top:0;height:100%;z-index:1000;display:none;}#authorDiv{display:none;}.authorDiv{z-index:1000;position:absolute;width:406px;height:200px;left:40%;top:40%;border:none;border-width:0;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/author_bg.png);}#author_result{position:absolute;width:320px;top:5px;left:45px;font_size:12px;text-align:center;}#authorDiv_content{position:absolute;width:100%;top:49px;left:165px;font-size:15.5;font-weight:bolder;color:#767c8a;border:0;}#authorDiv_foot{position:absolute;bottom:5px;left:15%;}#authorDiv_foot img{outline:none;border:0;text-align:center;}#authorDiv_content input{font-size:12px;border:none;border-width:0;}#author_validImage{padding-left:5px;vertical-align:text-bottom;height:19px;}#author_validcode_sm{width:107px;}#authorOkNoId{padding-left:100px;}.checkOn{position:relative;width:70px;heigth:20px;max-heigth:20px;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:2px -70px;line-height:20px;top:-4px;}.checkOn table,.checkOff table{border:0;border-width:0;height:100%;left:-2px;position:relative;}.checkOff{position:relative;width:70px;heigth:20px;max-heigth:20px;background-repeat:no-repeat;background-image:url(http://10.2.0.34:8082/eportal/images/login/page/tubiao.png);background-position:-76px -70px;line-height:20px;top:-4px;}.iphone_on,.iphone_off{width:35px;left:0;top:0;heigth:20px;cursor:pointer;}

</style> </head> <body id="loginbody" oncontextmenu="return false;" ondragstart="return false;"> <img id="forceSwitchAddUser" val="http://1.1.1.1" style="display: none;width: 0px;height: 0px;"/> <form name="loginForm" id="loginForm" method="post" action="webgateuser.do?method=login_ajax_s26_in_out"> <div id="contentDive"> <div class='slide'><img src='http://10.2.0.34:8082/eportal/nodeDir/msg/7d85b30b389c4f6a812f0fc13b91fa22/1/1.jpg' val='http://10.2.0.34:8082/eportal/nodeDir/msg/7d85b30b389c4f6a812f0fc13b91fa22/1/1.jpg'/></div><div class='slide'><img val='http://10.2.0.34:8082/eportal/nodeDir/msg/7d85b30b389c4f6a812f0fc13b91fa22/2/2.jpg'/></div><div class='slide'><img val='http://10.2.0.34:8082/eportal/nodeDir/msg/7d85b30b389c4f6a812f0fc13b91fa22/3/3.jpg'/></div><div class='slide'><img val='http://10.2.0.34:8082/eportal/nodeDir/msg/7d85b30b389c4f6a812f0fc13b91fa22/4/4.jpg'/></div> <div id="head_gongneng"> <div id="autoLogin"> <ul> <li id="is_auto_land_li"> <select name="is_auto_land" id="is_auto_land" val="true"> <option value="false">OFF</option> <option value="true">ON</option> </select> <li>保存登录信息</li> <li><a href="#" tabIndex="-1" id="register" onclick="showAuthorDiv();">二维码编号认证&nbsp;</a></li> </ul> </div> </div> <div id="errorInfo"> <div id="errorInfo_left"></div> <div id="errorInfo_center" val=""></div> <div id="errorInfo_right"> <img id="right_bg" val="http://10.2.0.34:8082/eportal/images/login/page/error_right.png"> <img id="right_close" val="http://10.2.0.34:8082/eportal/images/login/page/error_close.png" onclick="hideAuthFailMessage();"> </div> </div> <div id="loginFrame"> <div id="loginFrameLogo"> </div> <div id="loginContent"> <div class="login_frame_top"></div> <div class="login_frame"> <div class="login_frame_hang"> <div class="left_right_input"> <div id="username_left" class="left"></div> <div class="right"> <input name="usernameHidden" id="usernameHidden" type="hidden"/> <input class="input_tip" name="username_tip" id="username_tip" readonly='readonly' value="Username"/> <input class="input" name="username" id="username" tabIndex="0" type="text" tipInfo="Username" value=""/> </div> </div> </div> <input name="strTypeAu" id="strTypeAu" type="hidden"/> <input name="uuidQrCode" id="uuidQrCode" type="hidden"/> <div class="login_frame_hr"></div> <div class="login_frame_hang"> <div class="left_right_input"> <div id="pwd_left" class="left"></div> <div class="right"> <input name="authorMode" id="authorMode" type="hidden"/> <input class="input_tip" name="pwd_tip" id="pwd_tip" readonly='readonly' value="Password"/> <input name="pwd" class="input" id="pwd" type="password" tabIndex="1" tipInfo="Password" value=""/> </div> </div> </div> <div class="login_frame_hr"></div> <div class="login_frame_hang" id="serviceShowHideTop"> <div class="left_right_input"> <div class="left" id="service_left"></div> <div class="right"> <div id="selectDisname" tabIndex="3">internet</div><input name="net_access_type" id="net_access_type" value='internet' type="hidden"/> <div class="xiala" id="xiala"></div> </div> </div> </div> </div> <div class="login_frame_bottom"></div> <div id="serviceShowHide"> <div class="login_frame_top"></div> <div> <div class="login_frame"> <div id='bch_service_internet' class="login_frame_hang" onmouseover="mOver(this)" onmouseout="mOut(this)" onclick="selectService('internet','internet')"><div class="left_right_input"> <div id="service_detail_left" class="left"></div> <div class="right" id='_service_0'>internet </div></div></div><div id='bch_service_无线接入' class="login_frame_hang" onmouseover="mOver(this)" onmouseout="mOut(this)" onclick="selectService('无线接入','无线接入')"><div class="left_right_input"> <div id="service_detail_left" class="left"></div> <div class="right" id='_service_1'>无线接入 </div></div></div><div id='bch_service_default' class="login_frame_hang" onmouseover="mOver(this)" onmouseout="mOut(this)" onclick="selectService('default','mac快速接入')"><div class="left_right_input"> <div id="service_detail_left" class="left"></div> <div class="right" id='_service_2'>mac快速接入 </div></div></div><script>var services=[{"aceNotShow":"false","serviceDefault":"true","serviceName":"internet","serviceShowName":"internet"},{"aceNotShow":"false","serviceDefault":"false","serviceName":"无线接入","serviceShowName":"无线接入"},{"aceNotShow":"false","serviceDefault":"false","serviceName":"default","serviceShowName":"mac快速接入"}]</script> </div> </div> <div class="login_frame_bottom"></div> </div> <div id="login_btn"> <DIV id=SLoginBtn class=SLoginBtn><OL> <LI><A id=loginLink tabIndex=5 onclick=doauthen(); href="#"> <DIV>登录 </DIV></A></LI></OL></DIV> </div> </div> </div> <div id="authorframe"> </div> <div id="authorDiv" style="z-index:1002;"> <div id="author_result" align="center"> </div> <div id="authorDiv_content"> <input name="authorCode" id="authorCode" type="text"/> </div> <div id="authorDiv_foot"> <table width="300px" height="45px"> <tr> <td align="center"> <a href="#" tabIndex="-1" id="author_foot_ok_no" onclick="hideAuthor()"><img id="authorDiv_return" val="http://10.2.0.34:8082/eportal/images/login/page/regist_return.png"/></a> </td> <td align="center" id="authorOkNoId"> <a href="#" tabIndex="-1" id="author_foot_ok_sub_no" onclick="authorProcess();"><img id="authorDiv_ok" val="http://10.2.0.34:8082/eportal/images/login/page/author_ok.png"/></a> </td> </tr> </table> </div> </div> <div id='gonggaolan_content_touming' class='xiaoxi_touming'> <div id="gonggaolan_content" isShow="true" class="xiaoxi_content"><div style="top: 0px;">认证成功后,请不要关闭此页面,否则将中断网络连接。<br/>自助修改密码、密码找回、自助下线请访问<br/><a href="http://auth.。</div><div style="top: 0px;"></div></div> </div> <div id='yonghuxuzhi_content_touming' class='xiaoxi_touming'> <div id="yonghuxuzhi_content" class="xiaoxi_content"><div style="top: 0px;">认证成功后,请不要关闭此页面,否则将中断网络连接。<br/>自助修改密码、密码找回、自助下线请访问<br/><a href="http://auth.。</div><div style="top: 0px;"></div></div> </div> <div id='xitongtongzhi_content_touming' class='xiaoxi_touming'> <div id="xitongtongzhi_content" class="xiaoxi_content"><div style="top: 0px;">认证成功后,请不要关闭此页面,否则将中断网络连接。<br/>自助修改密码、密码找回、自助下线请访问<br/><a href="http://auth.。</div><div style="top: 0px;"></div></div> </div> <div id="foot_control"> <div id="control"> <ul> <li><a href="#" class="next" tabIndex="-1" id="next" title="下一页"><div id="next_div"></div></a></li> <li><a href="#" class="prev" tabIndex="-1" id="prev" title="上一页"><div id="prev_div"></div></a></li> <li><a href="#" class="full" tabIndex="-1" id="full" title="全屏"><div id="full_div" val="max"></div></a></li> </ul> </div> <div id="foot"> <div id="foot_content"> <ul> <li><a id="gonggaolan" tabIndex="-1"><div><div class="left_div"></div><div class="center_div">公告栏</div><div class="right_div"></div></div></a></li> <li><a id="yonghuxuzhi" tabIndex="-1"><div><div class="left_div"></div><div class="center_div">用户须知</div><div class="right_div"></div></div></a></li> <li><a id="xitongtongzhi" tabIndex="-1"><div><div class="left_div"></div><div class="center_div">系统通知</div><div class="right_div"></div></div></a></li> </ul> </div> </div> </div> <img style='width:0px;height:0px;' src='http://10.2.0.34:8082/eportal/images/login/page/tubiao.png'/> </div> </form> </body> </html> <script type="text/javascript">
    jqueryBind();
    delCookie("SUCCESS_USER_URL");
    delCookie("SUCCESS_PORTAL_URL");
</script>
<script type="text/javascript">


var search = window.location.search;


var index_params = search.replace('?','');
    if(document.getElementById("index_params")){
        document.getElementById("index_params").value=index_params;
    }
    if(typeof(userName)!='undefined'){
        document.getElementById('username').value = decodeURI(userName);
    }
    if(typeof(userName)!='undefined'){
        document.getElementById('usernameHidden').value = decodeURI(userName);
    }
    if(typeof(userPwd)!='undefined'){
        document.getElementById('pwd').value = decodeURI(userPwd);
    }
    if(document.getElementById("noticeContent")){
        var noticeContent = document.getElementById("noticeContent").innerHTML;
        document.getElementById("noticeContent").innerHTML=urlReplace(noticeContent);
    }
    function urlReplace(str_url){
        var strRegex =/((http|ftp|https|file):\/\/([\w\-]+\.)+[\w\-]+(\/[\w\u4e00-\u9fa5\-\.\/?\@\%\!\&=\+\~\:\#\;\,]*)?)/ig;
        var re=new RegExp(strRegex);
        var result=null;
        result=str_url.replace(re,'<a target="_blank" href="$1"><font color="blue"><U>$1</U></font></a>');
        return(result);
    }
</script>


[此贴子已经被作者于2023-7-29 17:21编辑过]

5 回复
#2
apull2023-07-29 18:52
登录执行的不是这个函数么
只有本站会员才能查看附件,请 登录
#3
约定的童话2023-07-29 19:45
用cls类模拟打开网页,输入用户名密码啥的登录
#4
yuanyong9112023-08-02 14:32
以下是引用apull在2023-7-29 18:52:34的发言:

登录执行的不是这个函数么

多谢 大神

多谢 大神 我成功了 如下代码

text1 = "张三"
text2 = "12346"


Dim d As Object, o As Object, pc As String
On Error Resume Next
Set d = WebBrowser1.Document
If d Is Nothing Then Exit Sub
Set o = d.getElementById("username")
o.Value = text1.Text
Set o = d.getElementById("Pwd")
o.Value = text2.Text

'点击登录按钮 成功 点击登录
WebBrowser1.Document.parentWindow.execScript "doauthen()"

[此贴子已经被作者于2023-8-2 16:56编辑过]

#5
yuanyong9112023-08-02 14:34
以下是引用约定的童话在2023-7-29 19:45:58的发言:

用cls类模拟打开网页,输入用户名密码啥的登录


text1 = "张三"
text2 = "12346"


Dim d As Object, o As Object, pc As String
On Error Resume Next
Set d = WebBrowser1.Document
If d Is Nothing Then Exit Sub
Set o = d.getElementById("username")
o.Value = text1.Text
Set o = d.getElementById("Pwd")
o.Value = text2.Text

'点击登录按钮 成功 点击登录
WebBrowser1.Document.parentWindow.execScript "doauthen()"

[此贴子已经被作者于2023-8-2 16:57编辑过]

#6
yuanyong9112023-08-02 16:57
回复 楼主 yuanyong911
text1 = "张三"
text2 = "12346"


Dim d As Object, o As Object, pc As String
On Error Resume Next
Set d = WebBrowser1.Document
If d Is Nothing Then Exit Sub
Set o = d.getElementById("username")
o.Value = text1.Text
Set o = d.getElementById("Pwd")
o.Value = text2.Text

'点击登录按钮 成功 点击登录
WebBrowser1.Document.parentWindow.execScript "doauthen()"
1