<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css"> </style>
</head>
<body>
<div align="center" >
姓名:<input type="text" name="stuName" id="stuName" value="姓名" onfocus="ffocus()"/>
年龄:<input type="text" name="age" id="age" value="年龄" onfocus="ffocus1()"/>
<br /><br />
<input type="button" value="注册" onclick="register()"/>
<!--
作者:1767757232@qq.com
时间:2017-10-22
描述: <input type="button" value="显示" onclick="show()" />
-->
<input type="button" value="清空" onclick="cclear()"/>
<div id="tip"></div>
<hr color="aqua"/>
<br />
<table id="tab" frame="border" width="30%" borderclorlight="aqua" border="1">
<tr><th>姓名</th><th>年龄</th></tr> </table>
<div id="show"></div>
<div id="show1"></div>
<div id="show2"></div> </div>
</body>
<script type="text/javascript">
var stuArr=new Array(3);
var i=0;
function register(){
var stuName=document.getElementById("stuName").value;
var age=document.getElementById("age").value; var student={stuName:stuName,age:age};
stuArr[i]=student;
document.getElementById("tab").innerHTML=document.getElementById("tab").innerHTML+"<tr><td>"+stuArr[i].stuName+"</td><td>"+stuArr[i].age+"</td></tr>";
i++;
document.getElementById("tip").innerHTML="注册成功"; } function ffocus(){
document.getElementById("stuName").value="";
document.getElementById("tip").innerHTML="";
}
function ffocus1(){
document.getElementById("age").value="";
document.getElementById("tip").innerHTML="";
}
function cclear(){
// stuArr.splice(0,0);
stuArr.splice(0,stuArr.length); document.getElementById("tab").innerHTML="<tr><th>姓名</th><th>年龄</th></tr> "; document.getElementById("tip").innerHTML="清空成功"; }
</script>
</html>

js注册实现的更多相关文章

  1. js注册读秒进度条

    转载自://http://blog.csdn.net/wugouzi/article/details/12621385 <head> <meta http-equiv="C ...

  2. js注册登录审核

    <script type="text/javascript"> $(function(){ $("#sendSms").click(function ...

  3. layer.js 注册登录切换的问题

    layer.js 是一个很好用的弹窗框架,使用的时候很方便,但是今天遇到一个问题,让我很头疼啊,一直都做不出来,就是登录和注册弹窗的切换问题 这里涉及到两个页面:guide.html 即父页面,den ...

  4. 微信小程序笔记<三>入口app.js —— 注册小程序

    小程序开发框架在逻辑层使用的语言就是JavaScript,所以想玩小程序JavaScript的基本功一定要扎实.但小程序基于js做了一些修改,以方便开发者更方便的使用微信的一些功能,使得小程序更好的贴 ...

  5. js 注册控件的onclick事件

    今天做了一个全选功能:1.点击全选,全部选中.选中状态再点击全选,全部取消选中2.点击成员,判断是否成员全部选中,true:全选为选中状态,false:全选为未选中状态. 使用js是比较麻烦的就是如何 ...

  6. js 注册事件

    <!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...

  7. js注册验证

    var user = $("user");var userCheck = $("userCheck");var pwd = $("pwd") ...

  8. js注册检测 用户名、密码、手机号、邮箱

    请输入电话号码:<input name="" type="text" id="telphone" value="" ...

  9. JS注册事件

    <html xmlns="http://www.w3.org/1999/xhtml"><head>    <title></title&g ...

  10. nuxt.js 注册全局组件

    plugins 属性配置 src: String (文件的路径) ssr: Boolean (默认为 true) 如果值为 false,该文件只会在客户端被打包引入. 根目录找到 nuxt.confi ...

随机推荐

  1. vue 2.x 的 v-bind 指令的 .prop 事件修饰符详解

    vue 官方文档对 .prop 修饰符的解释是: 使用例子: 那么,具体的原理和用法是什么呢?这要从 html 的 DOM node 说起. 在 html 标签里,我们可以定义各种 attribute ...

  2. Spring之Bean管理------注解方式

    编写测试类 1,编写相关的类 public interface UserDao { public void sayHello(); } public class UserDaoImpl impleme ...

  3. Java内存缓存-通过Map定制简单缓存

    缓存 在程序中,缓存是一个高速数据存储层,其中存储了数据子集,且通常是短暂性存储,这样日后再次请求此数据时,速度要比访问数据的主存储位置快.通过缓存,可以高效地重用之前检索或计算的数据. 为什么要用缓 ...

  4. cin.clear()与cin.sync()的使用

    cin.clear()与cin.sync()使用是有先后顺序的. 他们的作用: cin.clear(); //将流中的所有状态都重设为有效值 cin.sync();//清空流 在输入错误的情况下,如果 ...

  5. [GIT]提交后版本恢复

    如果在回退以后又想再次回到之前的版本,可以用relog查看commit id,再使用reset设置.   1.执行 relog 后:   展示的最前面的部分就是commit id,后面会用来作为恢复的 ...

  6. c++ / % 四舍五入 向上取整ceil 向下取整floor

     / % 四舍五入 向上取整ceil 向下取整floor #include <math.h> double floor(double x); float floorf(float x); ...

  7. 四、SpringBoot出现报错:java.lang.NoSuchMethodError: org.springframework.http.MediaType.equalsTypeAndSubtype(Lorg/springframework/util/MimeType;)Z

    idea启动SpringBoot项目后,出现如下错误: 2019-11-19 15:24:44.344 ERROR 39168 --- [nio-8443-exec-1] o.a.c.c.C.[.[. ...

  8. 如何在网页中添加 jQuery。

    转自:http://www.runoob.com/jquery/jquery-install.html 网页中添加 jQuery 可以通过多种方法在网页中添加 jQuery. 您可以使用以下方法: 从 ...

  9. Sql UpdateOrInsert

    SqlServer(先更新,受影响条数为0,则Insert,通过事务): begin tran update table set column=columnvalue where wherestr b ...

  10. layui 常用确认框、提示框 demo

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...