Json 入门例子(form表单)【0】

<script>
        $(function () {
     var aa = $("#fm").serialize().replace(/+/g, "");
     var ac = decodeURIComponent(aa);
     $("#fm").click(function () {
            alert(ac);
           });

        });

    </script>

    <form id="form1" name="form1" method="post" action="">
        <p>
            进货人 :
            <label for="name"></label>
            <input type="text" name="name" id="name" />
        </p>
        <p>
            性别:
            <label for="sex"></label>
            <select name="sex" size="1" id="sex">
                <option value="1">男</option>
                <option value="2">女</option>
            </select>
        </p>
        <table width="708" border="1">
            <tr>
                <td width="185">商品名</td>
                <td width="205">商品数量</td>
                <td width="296">商品价格</td>
            </tr>
            <tr>
                <td>
                    <label for="pro_name"></label>
                    <input type="text" name="pro_name" id="pro_name" />
                </td>
                <td>
                    <label for="pro_num"></label>
                    <input type="text" name="pro_num" id="pro_num" />
                </td>
                <td>
                    <label for="pro_price"></label>
                    <input type="text" name="pro_price" id="pro_price" />
                </td>
            </tr>
            <tr>
                <td><input type="text" name="pro_name2" id="pro_name2" /></td>
                <td><input type="text" name="pro_num2" id="pro_num2" /></td>
                <td><input type="text" name="pro_price2" id="pro_price2" /></td>
            </tr>
        </table>
        <p> </p>
        <input type="button" name="submit" onclick="onClik();" value="提交" />
    </form>
    <form id="fm">

        <input type="text" name="username" value="zhangsan" /><br /><br />
        <input type="text" name="age" value="12" /><br /><br />
        <input type="text" name="address" value="北京  朝阳" /><br /><br />
        <input type="text" name="job" value="IT" /><br /><br />
        <textarea name="content">abc + 123 + 456  </textarea>
        <input type="button" value="发送" onclick="add()" /><br /><br />


    </form> 

  

转载 请注明原文地址并标明转载:http://www.cnblogs.com/laopo 商业用途请与我联系:lcfhn168@163.com
原文地址:https://www.cnblogs.com/laopo/p/4757260.html