jquery验证时间(年月)六位如:200112
1个回答
展开全部
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(function(){
setInterval(function(){
$("#currentTime").text(new Date().toLocaleString());
},1000);
$("#datatime").change(function(){
var offset = $(this).children('option:selected').val();
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
$("#newtime").text(nd.toLocaleString());
});
});
</script>
当时时间::<span id="currentTime"></span><br>
选择时区的时间::<span id="newtime"></span><Br>
<select name="shtime" id="datatime" onchange="datatime()">
<option value="" selected>请选择时区</option>
<option value="1">时区1</option>
<option value="2">时区2</option>
<option value="5">时区5</option>
</select>
试试这个吧
<script type="text/javascript">
$(function(){
setInterval(function(){
$("#currentTime").text(new Date().toLocaleString());
},1000);
$("#datatime").change(function(){
var offset = $(this).children('option:selected').val();
d = new Date();
utc = d.getTime() + (d.getTimezoneOffset() * 60000);
nd = new Date(utc + (3600000*offset));
$("#newtime").text(nd.toLocaleString());
});
});
</script>
当时时间::<span id="currentTime"></span><br>
选择时区的时间::<span id="newtime"></span><Br>
<select name="shtime" id="datatime" onchange="datatime()">
<option value="" selected>请选择时区</option>
<option value="1">时区1</option>
<option value="2">时区2</option>
<option value="5">时区5</option>
</select>
试试这个吧
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询