js动态生成按钮并动态生成8位随机数
发布时间:2024-08-31 08:48:26
标签:js,生成按钮,生成8位随机数
<script language="javascript"> var i=0; var timer1; function doPrint() { //bdhtml=window.document.body.innerHTML; //sprnstr=""; //eprnstr=""; //prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); //prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr)); //window.document.body.innerHTML=prnhtml; window.print(); // window.document.body.innerHTML=bdhtml; } function init(){ x=Math.random(); x=Math.floor(x*100000000); if(x<9999999){ init(); }else{ i++; document.all.show.innerText=x; if(i==20){ var par=document.getElementById("mybutton"); var son_tr=document.createElement("TR"); var son_td=document.createElement("TD"); //列属性 son_td.colSpan="4"; son_td.setAttribute("align","center"); son_td.setAttribute("className","b_table_db1"); //生成密码属性 var input_type=document.createElement("INPUT"); input_type.type="button"; input_type.name="createCode"; input_type.value="确认密码"; input_type.onclick=save_onclick; input_type.setAttribute("className","button"); input_type.onFocus="this.blur();"; input_type.onmouseover='this.className="buttonY";'; input_type.onmouseout='this.className="button"'; //打印属性 var input_type2=document.createElement("INPUT"); input_type2.type="button"; input_type2.name="printButton"; input_type2.value="打印"; input_type2.onclick=doPrint; input_type2.setAttribute("className","button"); input_type2.onFocus="this.blur();"; input_type2.onmouseover='this.className="buttonY";'; input_type2.onmouseout='this.className="button"'; son_td.appendChild(input_type); son_td.appendChild(input_type2); son_tr.appendChild(son_td); par.appendChild(son_tr); } if(i<20){ timer1=setTimeout("init()",50); } } } //确认密码 function save_onclick(){ alert("确认密码"); } </script> <html> <head><title></title></head> <body> <table> <tr> <td id="show"></td> </tr> <tbody id="mybutton"></tbody> </table> </body> <script language="javascript"> init(); </script> </html>


猜你喜欢
- 编写tasks.pyfrom celery import Celeryfrom tornado.httpclient import HTTP
- 本文实例为大家分享了python实现单链表反转的具体代码,供大家参考,具体内容如下代码如下:class Node(object): 
- 在sql语句后使用 SCOPE_IDENTITY() 当然您也可以使用 SELECT @@IDENTITY 但是使用 SELECT @@ID
- 查看数据库show databases;创建数据库create DATABASE 数据库名称create DATABASE database
- 运行MySQL Server 5.0安装程序“setup.exe”,出现如下界面: 安装向导启动,按“Next”继续:
- 写在前面:在做表格的时候,难免会碰到做统计的时候。由于在项目中涉及到做统计的功能比较简单,之后也就没有过多的去研究更复杂的,这里简单记录下。
- nginx简单配置php服务(多个)摘要:大部分网站开发语言都要运行在服务器,比如主流的nginx、apache等等,部署服务器环境对于大部
- Sql Server的存储过程是一个被命名的存储在服务器上的Transacation-Sql语句集合,是封装重复性工作的一种方法,它支持用户
- 前言随着微信的普及,越来越多的人开始使用微信。微信渐渐从一款单纯的社交软件转变成了一个生活方式,人们的日常沟通需要微信,工作交流也需要微信。
- 利用numpy和scipy,我们可以很容易根据欧拉角求出旋转矩阵,这里的旋转轴我们你理解成四元数里面的旋转轴 import nu
- 让我们来看一些例子:--获取表的count信息select count(*) from T with(nolock)--获取特定值的coun
- 大家好,今天在写代码的时候,遇到了这样一种情况。我有如下所示的几个类用来存放程序配置(其实当做命名空间来用,同时感觉能够继承方便一点),im
- 本文实例讲述了Python设计模式之享元模式原理与用法。分享给大家供大家参考,具体如下:享元模式(Flyweight Pattern):运用
- 我们使用pycharm的时候,有时遇到了不认识的方法习惯于将鼠标悬停在方法上查看方法介绍。那么如何设置呢?下面小编给大家分享一下。首先假如我
- 1. 安装 xlrd 库Python 读取 Excel 中的数据主要用到 xlrd 第三方库。xlrd 其实就是两个单词的简化拼接,我们可以
- SQLServer中有五种约束,Primary Key约束、Foreign Key约束、Unique约束、Default约束和Check约束
- 因为自己在设计的时候就对这些东西经常不是很在意,以为是很小的事情,结果往往给自己搞出不少的麻烦。可能大家没有我这么粗心,不过还是想提醒一下跟
- 字符画是一种由字母、标点或其他字符组成的图画,它产生于互联网时代,在聊天软件中使用较多,本文我们看一下如何将自己喜欢的图片转成字符画。静态图
- 1、目录操作1.1、获取当前目录# coding:utf-8import os# 获取当前工作目录(绝对路径)print(os.getcwd
- JavaScript 语法约定1、大小写的区分1). JavaScript的关键字,永远都是小写的;2). 内置对象,如Math和Date是