初學PHP,菜鳥一個,記錄下學習過程遇到的問題..
點擊按鈕事件處理辦法
一個form表單裏兩個按鈕,一個處理form中的action事件,另一個則處理另珍上php事件
1.事例代碼:
<html>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
<script type=
"text/javascript"
>
function
aaa()
{
document.form.action=
"page2.php"
;
}
</script>
</head>
<body>
<form name=
"form"
method=
"post"
action=
"page1.php"
>
<input type=
"text"
name=
"name"
/>
<input type=
"submit"
name=
"check"
value=
"驗證碼"
onclick==
"aaa()"
/>
<input type=
"submit"
name=
"submit"
value=
"註冊"
/>
</form>
</body>
</html>
2.事例代碼
<html>
<head>
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
>
</head>
<body>
<form name=
"form"
method=
"post"
action=
"page1.php"
>
<input type=
"text"
name=
"name"
/>
<input type=
"submit"
name=
"check"
value=
"驗證碼"
onclick=
"javascript:this.form.action='page2.php';this.form.submit();"
/>
<input type=
"submit"
name=
"submit"
value=
"註冊"
/>
</form>
</body>
</html>