Microsoft Jscript运行时错误:必需对象 [英] Microsoft Jscript run time error : object required

查看:121
本文介绍了Microsoft Jscript运行时错误:必需对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的代码..当控件移到第一个If语句时,出现Microsoft Jscript run time error : object required错误.

Below is my code.. am getting the Microsoft Jscript run time error : object required error when the control moves to the first If statement.

if ((document.getElementById("cphContents_chktimetoschedule").checked == true) && (document.getElementById("cphContents_pnltimetoschedule").disabled == false))
{
    var aDate = new Date(document.getElementById("cphContents_txtapproval").value)
    var sDate = new Date(document.getElementById("cphContents_txtsubmission").value)
     
     if(approval.value == "" || submission.value == "")
        {
            alert("Please enter all the fields of Project Time to Schedule.");
            return false;
        }

推荐答案

您是否有机会在应用程序中使用母版页(ASP.NET)?如果是,请检查这些

ID,ClientID和UniqueID之间的区别 [控制ASP.NET中的Web控件ClientID值 [
Are you using Master pages(ASP.NET) in your application by any chance? If yes then check these

The difference between ID, ClientID and UniqueID[^]
Take Control Of Web Control ClientID Values in ASP.NET[^]

For example, use things like below
document.getElementById('<%=txtapproval.ClientID%>').value;


代替


instead of

document.getElementById("cphContents_txtapproval").value;


这篇关于Microsoft Jscript运行时错误:必需对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆