初学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>