1
我在我的应用程序中使用DHTML日历。点击日期时有 ,有表单提交操作。如何禁用点击第一次点击后的日历?[编辑解决]
我想在第一次点击后禁用日历,以便用户无法单击表单提交之前的其他日期。
我的代码是
<SCRIPT type="text/javascript">
function dateChanged(calendar)
{
// Beware that this function is called even if the end-user only
// changed the month/year. In order to determine if a date was
// clicked you can use the dateClicked property of the calendar:
if (calendar.dateClicked) {
// OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
var y = calendar.date.getFullYear();
var m = calendar.date.getMonth() + 1; // integer, 0..11
var d = calendar.date.getDate(); // integer, 1..31
var NewDate = y + "-" + m + "-" + d;
document.getElementById("<?=$mydata[FILTER]?>").value = NewDate;
submitForm();
}
var tempDate = new Date(<?=$CalDate?>);
Calendar.setup({
flat : "<?=$mydata[FILTER]?>_show_date", // ID of the parent element
flatCallback:dateChanged, // our callback function
weekNumbers:false, // Don't display week numbers
date : tempDate
// Set calendar to start at selected date
});
document.getElementById("<?=$mydata[FILTER]?>").value = '<?=$mydata[FILTER]?>';
我给这个 我禁用股利和使用该代码的DIV 的所有儿童
**var nodes = document.getElementById("13-1_show_date").getElementsByTagName('*');
for(var i = 0; i < nodes.length; i++)
{
nodes[i].disabled = true;
}
submitForm();**
此代码将禁用解决方案第一次点击后div和它的孩子。
我们可以做到这一点。 但问题是它应该是可见的用户日历已禁用,无法再单击,直到表单提交。 –
然后只需使用CSS即可。 –
请问你能更清楚吗? 使用CSS,我们如何阻止点击 我不想隐藏日历。 –