注册 登录
编程论坛 VB6论坛

谁有TABWeb控件自动填表单例子或VB代码

rogersgb 发布于 2017-10-28 13:14, 2157 次点击
网页代码如下:
程序代码:
<form  method="post" id="fm1" commandName="${commandName}" htmlEscape="true"  class="form-horizontal center-block" action="#" style="color:#555555;">

                                    <div class="custom-input-item row-border">
                                        <label>账号</label>
                                        <label class="line">|</label>
                                        <input id="username" name="username" tabindex="1" placeholder="手机号码/ 纳税人识别号" required>
                                    </div>

                                    <div class="custom-input-item row-border">
                                        <label>密码</label>
                                        <label class="line">|</label>
                                        <input autocomplete="off" type="password" tabindex="2" id="password" name="password" placeholder="请输入密码" required size="25" tabindex="2" path="password" placeholder="请输入密码">
                                    </div>


                                    <div class="custom-input-item vcode row-border">
                                        <label>验证码</label>
                                        <label class="line">|</label>
                                        <input id="vcode" name="vcode" tabindex="3" placeholder="验证码">
                                        <span id="capslock-on"><img src="../kaptcha.jpg" id="yzmImg"><spring:message code="screen.capslock.on" /></span>
                                    </div>
                                    <!--./kaptcha.jpg-->

                                    <div class="form-group" style="margin: 0px;">
                                        <div>
                                            <input type="hidden" name="lt" value="${loginTicket}" />
                                            <input type="hidden" name="execution" value="${flowExecutionKey}" />
                                            <input type="hidden" name="_eventId" value="submit" />
                                            <button id="loginBtn1"  type="button"  name="submit" accesskey="l" tabindex="6" class="btn bg-login btn-block" >登录</button>
                                        </div>
                                        <div class="" style="padding-top: 3em;text-align: center">
                                            <a href="./forgetPwd.html" class="text-danger">忘记密码|</a>
                                            <a href="./register.html">注册|</a>
                                            <a href="/dzswj/main/index.html">进入首页</a>
                                        </div>
                                    </div>
                                </form>
3 回复
#2
ZHRXJR2017-10-28 19:25
关键是下面三句代码,只要加入默认值 value 就可以了,由于你没有说明怎么自动填写,填写的数据从哪里来,因此就不好说了。
<input id="username" name="username" tabindex="1" placeholder="手机号码/ 纳税人识别号" required>
<input autocomplete="off" type="password" tabindex="2" id="password" name="password" placeholder="请输入密码" required size="25" tabindex="2" path="password" placeholder="请输入密码">
<input id="vcode" name="vcode" tabindex="3" placeholder="验证码">
#3
Artless2017-10-29 02:44
编程无自动
#4
rogersgb2017-10-29 09:39
回复 2楼 ZHRXJR
主窗口main,显示用户信息,点击按钮后,显示frmweb窗口用TABWEB控件浏览器,显示网页登陆信息自动输入main窗口的信息.
我知道用webbrowser控件代码如下
程序代码:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim vDoc, vTag
    Dim k As Integer
      
    Set vDoc = WebBrowser1.Document
        For k = 0 To vDoc.All.length - 1
        If UCase(vDoc.All(k).tagName) = "INPUT" Then
            Set vTag = vDoc.All(k)
            If vTag.Type = "text" Or vTag.Type = "password" Then
               
                Select Case vTag.id
                    Case "username"
                        vTag.Value = frmmain.Text1.Text
                    Case "password"
                        vTag.Value = frmmain.Text2.Text
                    
                End Select
            ElseIf vTag.Type = "button" Then
                vTag.Click
            End If
        End If
    Next k
End Sub
那用TABWEB控件代码应如何写
1