在做管理頁面的時候常常遇到這樣的情況:全選所有列表,然后進(jìn)行多個操作(刪除、轉(zhuǎn)移等),這樣每條記錄做一個表單比較麻煩,HTML代碼太多而且操作復(fù)雜。通常會遇到了一個表單提交到不同的處理頁面,比如執(zhí)行刪除的delete.asp或者move.asp。上網(wǎng)找了下資料,大多數(shù)方法都是通過Javascipt來實現(xiàn)了以上的功能,代碼如下。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>一個表單、多個提交按鈕、提交到多個不同頁面</title>
- </head>
-
- <script>
- function sm1(){
- document.getElementById("form_78").action="1.asp";
- document.getElementById("form_78").submit();
- }
- function sm2(){
- document.getElementById("form_78").action="2.asp";
- document.getElementById("form_78").submit();
- }
- </script>
- <form action="" method="post" name="form_78" id="form_78">
- <input name="mytext" type="text" id="mytext" />
- <input name="bt1" type="button" id="bt1" value="提交到1.asp" onclick="sm1()" />
- <input name="bt2" type="button" id="bt2" value="提交到2.asp" onclick="sm2()" />
- </form>
- </body>
- </html>
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點(diǎn)擊舉報。