我加載了一個內部頁面,我在IE中開發,並在底部顯示一些JS錯誤: 它說行107字符6.我看看JScript文件,它有這樣的代碼:JS錯誤:對象預計
function isLessThanStartDate(obj)
{
var startdate = new Date(document.getElementById('txtSD').value);
var enddate = new Date(obj.value);
var weekending = new Date(document.getElementById('txtWE').value);
if (!(isDate(startdate)))
{
obj.style.backgroundColor="red";
alert (obj.value + " is not a valid date!");
obj.value="";
return;
}
if (enddate < startdate)
{
obj.style.backgroundColor="red";
alert ("End date: " + enddate + " cannot be less then start date: " + startdate);
obj.value="";
}
else if (enddate > weekending)
{
obj.style.backgroundColor="red";
alert ("End date: " + enddate + " cannot be greater then week ending date: " + weekending);
obj.value="";
}
else
{
obj.style.backgroundColor="";
}
}
線107是在那裏說
var weekending = new Date(document.getElementById('txtWE').value);
這是爲什麼抱怨行?我沒有看到有什麼不對...
我不相信錯誤報告使用短語「一些JS錯誤」。它實際上說了什麼? – Quentin 2011-05-17 15:49:42
如果它是IE瀏覽器,它不會比這更好... – Rudie 2011-05-17 15:51:08
@David Dorward - @Rudie是正確的,它不顯示其他許多..我嘗試使用螢火蟲,但它不給我任何信息(因爲我不知道如何使用它)。它說:用戶代理:Mozilla/4.0(兼容; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.3; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322)時間戳:2011年5月17日星期二15:52:00 UTC消息:Object required行:150字符:5代碼:0 URI :http://localhost/blah/include/JScript.js消息:需要的對象行:107字符:6代碼:0 – oJM86o 2011-05-17 15:52:28