[問題] button跟submit
※ [本文轉錄自 java 看板]
作者: cymk (專業鄉民) 看板: java
標題: [問題] button跟submit
時間: Tue Apr 22 22:21:32 2008
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "" rel="nofollow">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="" rel="nofollow">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> </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> </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
→
04/22 22:43, , 1F
04/22 22:43, 1F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
6
14