<label>Year</label>
<asp:Textbox id="year" runat="server" placeholder="year">
若要尝试输入此文本框,请只允许此文本框到2018年。提前谢谢。
发布于 2018-07-26 20:26:32
请尝试下面的代码,别忘了检查数据类型:
<script>
/* code for jQuery */
$('#id').click(function(){\
if($('#year').val() > 2018){
//html message or alert box whatever you want.
}
});
/*code for core javascript */
function checkYear(){
var year = document.getElementById('year').value;
if(year > 2018){
//html message or alert box whatever you want.
}
}
</script>
https://stackoverflow.com/questions/51538692
复制相似问题