自动填充表单并使用URL参数自动提交 [英] Auto populate form and auto submit with URL Parameters

查看:90
本文介绍了自动填充表单并使用URL参数自动提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用网址参数自动填充以下表单,例如使用以下网址:

I want to auto populate the below form with URL parameters for example using a URL like this:

example.co.uk/example.php?acct=wirelesslogicde& ; pwd = jenkins

example.co.uk/example.php?acct=wirelesslogicde&pwd=jenkins

如果可能,我还希望自动提交,我该怎么做?

I would also like it to Auto submit if possible, how would I go about this??

            <form action="http://www.twg.com/logincheck.aspx" method="post" name="login" style="margin-bottom: 0;">
            <p class="readmore" style="margin-bottom: 0;">
            <input name="module" id="module" type="hidden" value="HL"/>
            <input name="page" id="page" type="hidden" value="account.aspx"/>
            <strong>Account:</strong> <br />
            <input name="acct" id="acct" class="contact input" size="12" maxlength="16"/>
            <br />             
            <strong>Password:</strong> <br />
            <input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16"/><br /><br />
            <input type="submit" name="submit" id="submit" class="button" value="Login"/>
            </p>
            </form>

新表格:

    <head>
    <script src="jq.js" type="text/javascript"></script>
    </head>

    <form action="http://www.zstats.com/logincheck.aspx" method="post" name="login" style="margin-bottom: 0;" id="zstatslogin">
    <p class="readmore" style="margin-bottom: 0;">
    <input name="module" id="module" type="hidden" value="HL"/>
    <input name="page" id="page" type="hidden" value="account.aspx"/>
    <strong>Account:</strong> <br />
    <input name="acct" id="acct" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['acct']; ?>"/>
    <br />             
    <strong>Password:</strong> <br />
    <input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['pwd']; ?>"/><br /><br />
    <input type="submit" name="submit" id="login" class="button" value="Login"/>
    </p>
    </form>

    <script type="text/javascript">
    $(document).ready(function() {
    $("#login").submit();       
    }); 
    </script>


推荐答案

你可以使用jQuery做自动提交

you could do the autosubmit by using jQuery

$('#some_form_id').onLoad(function(){
$.Post('form_target',{parameters:values});
});

您可以添加填充

<input name="acct" id="acct" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['acc']; ?>"/>
<input type="password" name="pwd" id="pwd" class="contact input" size="12" maxlength="16" value="<?php echo $_REQUEST['pwd']; ?>"/>

这篇关于自动填充表单并使用URL参数自动提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆