我有一个问题,就是在asp.net中控制calenderextender。例如用户无法选择backdate因此我在aspx上编写了Javascript函数并将其命名为aspx.cs。但是我收到错误了" myfunction未定义"
我的功能
<script type="text/javascript">
function myfunction() {
document.getElementById('txt_conferenceDate').onchange = function () {
var selectedDateFromCalendar = new Date(this.value);
var currentdate = new Date();
var Diff = new Date(selectedDateFromCalendar) - currentdate;
var diffDays = Math.ceil(Diff / (1000 * 3600 * 24));
if ((selectedDateFromCalendar) - currentdate < 0) {
alert("");
}
}
}
</script>
电话陈述
ScriptManager.RegisterClientScriptBlock(this, GetType(), "myfunction", "myfunction();", true);