大二下学期学习进度(十一)

编程时间:18小时左右

代码行数:约1600行

博客园发表量:4篇

所学知识点:

1)window.onload() 方法用于在网页加载完毕后立刻执行的操作,即当 HTML 文档加载完毕后,立刻执行某个方法。

header("Location:hw3.3.php");表示跳转页面。
echo "<script>alert('1+2+...+$number=$sum')</script>";
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div style="text-align: center"><b>用户注册</b></div>
<form style="text-align: center" id="form1" name="form1" method="post" action="">
<p>&nbsp;&nbsp;&nbsp;&nbsp;用户名:
<input type="text" name="xm">
</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;密码:
<input type="password" name="pwd1">
</p>
<p>确认密码:
<input type="password" name="pwd2">
</p>
<p>
<input type="submit" name="submit" value="提交">
<input type="reset" nmae="reset" value="重置">
</p>
</form>
</body>
</html>
<script>
window.onload=function () {
<?php
if (!empty($_POST)){
$username=$_POST['xm'];
$pwd1=$_POST['pwd1'];
$pwd2=$_POST['pwd2'];
if(empty($username)){
echo "alert('用户名不能为空');";}
else if(!empty($_POST['pwd1'])&&!empty($_POST['pwd2']))
if($pwd1!==$pwd2){
echo"alert('两次密码不一样');";
}
else
header("Location:hw3.3.php");
}
?>
}
</script>
原文地址:https://www.cnblogs.com/zzstdruan1707-4/p/10934620.html