asp.net js 倒计时总秒数量 和 排序
Edit in JSFiddle JavaScript HTML CSS Result h1 {
font-family: "微软雅黑";
font-size: 40px;
margin: 20px 0;
border-bottom: solid 1px #ccc;
padding-bottom: 20px;
letter-spacing: 2px;
}
.time-item strong {
background: #C71C60;
color: #fff;
line-height: 49px;
font-size: 36px;
font-family: Arial;
padding: 0 10px;
margin-right: 10px;
border-radius: 5px;
box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
}
#day_show {
float: left;
line-height: 49px;
color: #c71c60;
font-size: 32px;
margin: 0 10px;
font-family: Arial, Helvetica, sans-serif;
}
.item-title .unit {
background: none;
line-height: 49px;
font-size: 24px;
padding: 0 10px;
float: left;
}
var intDiff = parseInt(86400); //倒计时总秒数量
function timer(intDiff) {
window.setInterval(function () {
var day = 0,
hour = 0,
minute = 0,
second = 0; //时间默认值
if (intDiff > 0) {
day = Math.floor(intDiff / (60 * 60 * 24));
hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
}
if (minute <= 9) minute = '0' + minute;
if (second <= 9) second = '0' + second;
$('#day_show').html(day + "天");
$('#hour_show').html('<s id="h"></s>' + hour + '时');
$('#minute_show').html('<s></s>' + minute + '分');
$('#second_show').html('<s></s>' + second + '秒');
intDiff--;
}, 1000);
}
$(function () {
timer(intDiff);
});
<h1>网页上的倒计时</h1>
<div class="time-item">
<span id="day_show">0天</span>
<strong id="hour_show">0时</strong>
<strong id="minute_show">0分</strong>
<strong id="second_show">0秒</strong>
</div>
---------------------------------------排序
function test() {
var numbers = [12, 23, 10, 56, 7, 88, 92, 49];
numbers = numbers.sort(function (a, b) {
return a - b;
})
var val;
for (var i = 0; i < numbers.length; i++) {
val += numbers[i] + '<br/>';
}
$('#show8').html(val);
}
<div>
<input type="button" value="提交" onclick="test()" />
<h3>数值数组排序前</h3>
<div id="show7"></div>
<h3>排序后</h3>
<div id="show8"></div>
</div>
asp.net js 倒计时总秒数量 和 排序的更多相关文章
- js倒计时,秒倒计时,天倒计时
按天倒计时 HTML代码1: <Script Language="JavaScript"> <!-- Begin var timedate= new Date(& ...
- 小巧实用js倒计时
<script type="text/javascript"> var intDiff = parseInt(15); //倒计时总秒数量 functi ...
- js 验证码 倒计时60秒
js 验证码 倒计时60秒 <input type="button" id="btn" value="免费获取验证码" /> & ...
- js实现倒计时60秒的简单代码
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Conten ...
- js 简单实现获取短信按钮倒计时60秒
<!DOCTYPE html><html lang="en"><head> <meta http-equiv="Content- ...
- js倒计时-倒计输入的时间
计算指定时间到指定时间之间相差多少天.时.分.秒. 节日.活动.商城常用. 原理: 主要使用到时间戳,也就是从1970 年 1 月 1 日 到指定时间的毫秒数. 1. 求出毫秒差 :当两个时间直接进行 ...
- js 倒计时(可自定义时间)
<html> <head> <title>js 倒计时</title> </head> <body> <div> & ...
- js倒计时显示
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>j ...
- iOS-验证码倒计时60秒
一. 要求 1.点击获取验证码按钮,60秒倒计时,按钮变成不可点击状态,按钮文字变成倒计时的秒数. 2.当倒计时为0的时候,释放掉定时器NSTimer,按钮变成可以点击状态,按钮文字变成"获 ...
随机推荐
- thinkphp 配置多数据库
1配置文件中配置另一数据库连接信息 例如: 'TestModelConfig' => array( //'配置项'=>'配置值' 'DB_TYPE' => 'mysql', // 数 ...
- Android Studio2.0 教程MAC版 -快捷键篇
本文转至 Android Studio2.0 教程从入门到精通MAC版 - 提高篇 ( OPEN 开发经验库) 第二篇我们开发了一个Hello World应用,并介绍Android Sutdio的界面 ...
- iOS开发--QQ音乐练习,旋转动画的实现,音乐工具类的封装,定时器的使用技巧,SliderBar的事件处理
一.旋转动画的实现 二.音乐工具类的封装 -- 返回所有歌曲,返回当前播放歌曲,设置当前播放歌曲,返回下一首歌曲,返回上一首歌曲方法的实现 头文件 .m文件 #import "ChaosMu ...
- 【UOJ #29】【IOI 2014】holiday
http://uoj.ac/problem/29 cdq四次处理出一直向左, 一直向右, 向左后回到起点, 向右后回到起点的dp数组,最后统计答案. 举例:\(fi\)表示一直向右走i天能参观的最多景 ...
- Oracle查询所有序列
--查看当前用户的所有序列 select SEQUENCE_OWNER,SEQUENCE_NAME from dba_sequences where sequence_owner='用户名'; --查 ...
- Tomcat-在发布项目时两次重复加载的问题介绍与解决
前提: 如 1.存在某个应用:hello 2.该应用存放路径:D:\apache-tomcat-5.5.17\webapps\hello 3.Tomcat的server.xml部分配置信息如下: ...
- hibernate DetachedCriteria实现多表关联查询createAlias的使用
记录本例查询初衷: 有表: 表1,表2,表3 关系 1 many-to-one 2 2 many-to-one 3 结果:要通过表3中的条件反向查询表1中相关的数据 public Page<We ...
- 控件(进度类): RangeBase, Slider, ProgressBar, ProgressRing
1.RangeBase(基类) 的示例Controls/ProgressControl/RangeBaseDemo.xaml <Page x:Class="Windows10.Cont ...
- hibernate查询返回一个list ,Date类型追加数据
public Pagination getLookPage(BeanPatrolScheduling beanPatrolScheduling, int pageNo, int pageSize) { ...
- Leetcode Bulb Switcher
There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every ...