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,我們如何阻止點擊 我不想隱藏日曆。 –