日期:2014-05-16  浏览次数:20388 次

一个不大不小的form表单提交问题
HTML code

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs
/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function (){
    $("#un").click(function (){
        $("form").submit();
    });
});
</script>

</head>
<body>
    <form action="index.php" method="post">
        <input id="un" readonly="readonly" type="text" name="code" value="username" />
        <input type="text" readonly="readonly" name="password" value="password" />
        <input type="hidden" name="type_val" value="1" />
        <input type="hidden" name="keeplive" value="1" />
        <input type="hidden" name="submit" value="立即登录" />
    </form>
</body>
</html>



我想post一个key是submit,value等于"立即登录"的键值对,应该怎么办呢?

等同于下面点击立即登录的效果
HTML code

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>

</head>
<body>
    <form action="index.php" method="post">
        <input id="un" readonly="readonly" type="text" name="code" value="username" />
        <input type="text" readonly="readonly" name="password" value="password" />
        <input type="hidden" name="type_val" value="1" />
        <input type="hidden" name="keeplive" value="1" />
        <input type="submit" name="submit" value="立即登录" />
    </form>
</body>
</html>



------解决方案--------------------
HTML code

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>

</head>
<body>
    <form action="index.php" method="post">
        <input id="un" readonly="readonly" type="text" name="code" value="username" />
        <input type="text" readonly="readonly" name="password" value="password" />
        <input type="hidden" name="type_val" value="1" />
        <input type="hidden" name="keeplive" value="1" />
        <input type="hidden" name="submit" value="立即登录" />
        <input type="submit" value="立即登录" />
    </form>
</body>
</html>

------解决方案--------------------
<input type="submit" name="sub" value="立即登录" /> //改个名字