DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML和Xhtml >> HTML表單提交的幾種方式
HTML表單提交的幾種方式
編輯:HTML和Xhtml     

方式一:通過submit按鈕提交

<!DOCTYPE html>
<html>
<head>
    <title>通過submit按鈕提交</title>
    <meta charset="UTF-8"/>
</head>
<body>
    <form action="" method="get" id="form1">
        <input type="text" name="username"></input>
        <input type="submit" value="提交" />
    </form>
</body>
</html>

方式二:通過一般按鈕button提交

<!DOCTYPE html>
<html>
<head>
    <title>通過一般按鈕提交</title>
    <meta charset="UTF-8"/>
</head>
<body>
    <form action="" method="get" id="form1">
        <input type="text" name="username"></input>
        <input type="button" value="ok" name="sb" onclick="submit1();">
    </form>
    <script type="text/javascript">
        function submit1()
        {
            var form1 = document.getElementById("form1");
            form1.action = " bjpowernode.html";
            form1.submit();
        }
    </script>
</body>
</html>

方式三:通過超鏈接提交

<!DOCTYPE html>
<html>
<head>
    <title>通過超鏈接提交</title>
    <meta charset="UTF-8"/>
</head>
<body>
    <a href="bjpowernode.html?username=張三">通過超鏈接提交</a> 
</body>
</html>
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved