前端页面控制按钮可用时间

最近在H5页面的使用过程中有用前端 的一些小知识  ,在此处分享一下,先看下面代码


一、定时任务控制按钮的可用时间

  //控制按钮可用时间
     function reducetime(){
		  document.getElementById("sub").disabled = true;
		  document.getElementById("sub").value = 15;
		  window.setTimeout("tick()",1000);
		}
      
		function tick(){
		  var time = new Number(document.getElementById("sub").value);
		  if(time>0){
		    document.getElementById("sub").value = time-1;
		    window.setTimeout("tick()",1000);
		  }else{
		    document.getElementById("sub").disabled = false;
		  }
		}






  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是简单的步骤: 1. 打开 VS Code 编辑器。 2. 创建一个新的文件夹,用于存放你的前端页面。 3. 在 VS Code 中打开该文件夹。 4. 在 VS Code 的侧边栏中,点击“新建文件”按钮,创建一个名为 index.html 的文件。 5. 在 index.html 中编写 HTML 代码来构建页面的基本结构,例如: ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My First Frontend Page</title> </head> <body> <h1>Welcome to My First Frontend Page</h1> <p>This is a paragraph of text.</p> </body> </html> ``` 6. 保存 index.html 文件。 7. 在 VS Code 的侧边栏中,点击“新建文件”按钮,创建一个名为 style.css 的文件。 8. 在 style.css 中编写 CSS 代码来定义页面的样式,例如: ``` body { background-color: #f2f2f2; font-family: Arial, sans-serif; } h1 { color: #333; text-align: center; } p { color: #666; font-size: 18px; line-height: 1.5; padding: 20px; } ``` 9. 保存 style.css 文件。 10. 回到 index.html 文件,将 style.css 文件链接到页面中,例如: ``` <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>My First Frontend Page</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Welcome to My First Frontend Page</h1> <p>This is a paragraph of text.</p> </body> </html> ``` 11. 保存 index.html 文件。 12. 在浏览器中打开 index.html 文件,查看你的前端页面。 以上就是用 VS Code 编写一个简单的前端页面的步骤,希望能对你有所帮助。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值