1、web,千度网页
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>注册千度账号</title> <link rel="stylesheet" type="text/css" href="CSS/rg.css"> </head> <body> <div id="rg01"> <img src="img/regist.png" /> <p><span>我已注册,现在就<input type="button" value="登录" onClick="search()"></span><p> <img src="https://passport.baidu.com/static/passpc-account/img/reg/reg_hr.png" /> </div> <div id="rg02"> <div id="left"> <form action="getregister.php" method="post"> <ul> <li class="li"> <label class="label">用户名</label> <input class="rg" name="username" type="text" placeholder="请设置用户名" onFocus="Msg('Msg_01','block')" onBlur="Msg('Msg_01','none')" > <div id="Msg_01" class="msg" ><span> 设置后不可更改<br>中英文均可,最长14个英文或7个汉字</span></div> </li> <li class="li"> <label class="label">手机号</label> <input class="rg" name="tel" type="text" placeholder="可用于登录和找回密码" onFocus="Msg('Msg_02','block')" onBlur="Msg('Msg_02','none')" > <div id="Msg_02" class="msg" ><span>请输入中国大陆手机号,其他用户不可见</span></div> </li> <li class="li"> <label class="label">验证码</label> <input class="rg" name="code" type="text" placeholder="请输入验证码" > </li> <li class="li"> <label class="label"> 密码</label> <input class="rg" name="pwd" type="password" placeholder="请设置登录密码" > </li> <li> <input id="check" name="check" type="checkbox" > <label class="check">阅读并接受<a href="#" >《百度用户协议》</a></label> </li> <li class="sub"> <input id="submit" type="submit" value="注册"> </li> </ul> </form> </div> <div id="right"> <div id="top"> <h3>手机快速注册</h3> </div> <div id="bottom"> <p class="text">请使用中国大陆手机号,编辑短信:</p> <p class="warn">6-14位字符(支持数字/字母/符号)</p> <p class="text">作为登录密码,发送至:</p> <p class="warn">1069 0691 036590</p> <p class="text">即可注册成功,手机号即为登录帐号。</p> </div> </div> </div> <div id="rg03"> <p>2017 ©Baidu </p> </div> <div id="rg04"></div> <script > /* var name="张三"; var a=12,b=20; var day = new Date(); alert("my name is " + day.getFullYear()); var names=["张三","李四"]; for(var i =0;i<names.length;i++ ){ if (names[i]=="张三"){ alert(names[i]); } } var num=[0,1,2,3,4,5,6]; for(var i =0;i<num.length;i++ ){ if (num[i]%2==0){ alert(num[i]); } } */ names=[1,2,3,4,5,6] function search(){ var n =prompt(); for(i=0;i<names.length;i++){ if(n==names[i]){ alert("在"); } } alert("不在"); } function Msg(id,status){ document.getElementById(id).style.display=status; } </script> </body> </html>
2、往数据库写入数据(php)
<?php /*$uname=$_GET['username']; $umobile=$_GET['tel']; $uid=$_GET['code'];*/ /*$uname=$_POST['username']; $umobile=$_POST['tel']; $uid=$_POST['code'];*/ //插入 $con=mysql_connect("localhost:13306","root","123456"); if($con){ echo "sucess<br>"; }else{ echo "fail".mysql_error(); } mysql_select_db("stu"); mysql_query("set names utf8"); /*$sql="insert into stu values('$uid','$uname','$umobile')"; $res=mysql_query($sql); if($res){ echo "sucess01"; }else{ echo "fail01".mysql_error(); }*/ //查询语句 $query="select * from stu" ; $rest=mysql_query($query); echo "<table border='1'>"; while($row=mysql_fetch_row($rest)){ echo "<tr>"; echo "<td>$row[0]</td><td>$row[1]</td><td>$row[2]</td>"; echo "</tr>"; } echo "</table>"; ?>