看板 PHP 關於我們 聯絡資訊
※ [本文轉錄自 java 看板] 作者: cymk (專業鄉民) 看板: java 標題: [問題] button跟submit 時間: Tue Apr 22 22:21:32 2008 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=big5" /> <title>無標題文件</title> </head> <script type="text/javascript"> function check1(){ if(document.form1.username.value=="" || document.form1.password.value==""){ alert("請輸入帳號密碼!!"); } } </script> <body> <p>&nbsp;</p> <form name="form1" method="post" action="logincheck.php"> <label> username<br /> <input type="text" name="username" /> </label> <label> <br /> <br /> psaaword<br /> <input type="password" name="password" /> <br /> <br /> <input type="submit" name="button" value="送出" onClick="check1()" > </label> <input type="reset" name="reset" value="重新輸入" /> </form> <p>&nbsp; </p> </body> </html> 如果我在送出那個type使用submit 我前面的alert會跑的出來 但是就算我沒打帳號密它也會跳到logincheck.php這頁 如果type用button alert也會跑出來 但是...但是卻變成我就算打了帳密 它也不跳logincheck.php這頁 我該怎辦呢? 先感謝各位大大! -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.54.44 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.133.54.44
aqzb:form用onsubmit="XXX" 然後type還是用submit 04/22 22:43