時間選擇:
起始時間:<input type="text" value="2016-03-21 12:24:10" id="starttime" size="" class="m-wrap wid200 " onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
結束時間:<input type="text" value="2017-03-21 12:24:10" size="" class="m-wrap wid200 " id="startime1" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})">
checkbox復選框:
<input type="checkbox" value="" style="opacity: 0;" id="callever" name="callever">
<script>
// 區域報警設置的是否每天報警的時間不可選擇的js
$(function(){
$("#callever").change(function(){
if($("#callever").prop("checked")){ //prop()函數用於設置或返回當前jQuery對象所匹配的元素的屬性值,復選框被選中時
$("#starttime").attr('readonly','readonly'); //時間input文本添加屬性值
document.getElementById("starttime").style.color='rgb(173, 173, 173)';
document.getElementById("starttime").onclick=function(){};
$("#startime1").attr('readonly','readonly');
document.getElementById("startime1").style.color='rgb(173, 173, 173)';
document.getElementById("startime1").onclick=function(){};
}else{
document.getElementById("starttime").style.color='rgb(63, 63, 63)';
document.getElementById("startime1").style.color='rgb(63, 63, 63)';
$("#starttime").removeAttr('readonly','');
$("#startime1").removeAttr('readonly','');
document.getElementById("starttime").onclick=function(){laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})};
document.getElementById("startime1").onclick=function(){laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})};
}
})
})
</script>