- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在我的应用程序中,我有一个为特定日期设置默认值的 javascript。执行此操作的函数如下所示:
<script language='javascript'>
setNow(document.getElementById('date_86')); //line 166
setNow(document.getElementById('time_86'));
setNow(document.getElementById('date_0'));
setNow(document.getElementById('time_0'));
function setNow(element) { //line 173
date = new Date();date.setHours(date.getHours() + 3);
element.valueAsDate = date;
}
...
</script>
html:
<input type='date' id='date_86' name='date_86' />
有趣的是,直到最近它还可以工作,但现在不行了,Chrome 的控制台显示:
Uncaught Error: INVALID_STATE_ERR: DOM Exception 11
setNowmanual.html:173
(anonymous function)manual.html:166
如果我正确理解 this 的含义,我真的不明白为什么 setNow 不是这个 DOM 中的对象。
PS:当我交换声明和调用时发生同样的事情,只是控制台报告中的行号不同。
最佳答案
该死的!来自 Chromium 博客的引述 ( source )
Hi everyone, We disabled the following input types, and Google Chrome 16 isn't going to have them. date, datetime, datetime-local, month, time, and week. These types have had simple textfield interfaces with spin buttons. Since Google Chrome 16, they are not recognized as valid input types, and work as type=text. They were disabled because of their incompleteness. Their user-interfaces were not satisfying, and the existence of these types were harmfull for feature detection. We'll enable them again when we complete to implement their rich user-interfaces. -- TAMURA, Kent Software Engineer, Google
关于javascript - element.valueAsDate = xxx - 不再工作......(javascript),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8642921/
我有以下 Javascript 代码: var now = new Date(); now.setDate(now.getDate() + 7); document.getElementById('t
valueAsDate 的功能似乎存在根本性缺陷: var date1 = new Date(); date1 = new Date(date1.getFullYear(), date1.getMon
在我的应用程序中,我有一个为特定日期设置默认值的 javascript。执行此操作的函数如下所示: setNow(document.getElementById('date_86')); //lin
我尝试调试时遇到了这个奇怪的错误。我有一个输入字段,其中当前时间预先显示为值。当我运行该页面时,我收到引用 JavaScript 文件第 8 行的未捕获类型错误 (document.getElemnt
我是一名优秀的程序员,十分优秀!