作者cymk (专业乡民)
看板Web_Design
标题[问题] button跟submit
时间Tue Apr 22 22:28:14 2008
※ [本文转录自 PHP 看板]
作者: cymk (专业乡民) 看板: PHP
标题: [问题] button跟submit
时间: Tue Apr 22 22:22:53 2008
※ [本文转录自 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> </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
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.133.54.44
1F:→ emn178:<form onsubmit="check1()"..>.. <input type="submit"..> 04/22 22:49