ASP.NET의 기본 달력에 색상 변경 기능 이상의 마우스를 추가하려고합니다. 지금까지 다음 코드를 구현해 보았습니다.ASP.NET 달력의 날짜 강조 표시
Color col = new Color();
col = Calendar1.DayStyle.BackColor;
if (col != Color.Empty)
{
e.Cell.Attributes["onmouseover"] = "this.style.backgroundColor='pink';";
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='" + col + "';";
}
else
{
e.Cell.Attributes["onmouseover"] = "this.style.backgroundColor='pink';";
e.Cell.Attributes["onmouseout"] = "this.style.backgroundColor='';";
}
날짜를 클릭하지 않으면 정상적으로 작동하는 것 같습니다. 그러나 날짜를 클릭하면 날짜 배경이 회색으로 변경되고 배경색이 분홍색으로 변경된 다음 다시 흰색으로 되돌아갑니다. 어떻게 든 그것을하기 때문에이 줄을 것 같습니다
col = Calendar1.DayStyle.BackColor;
올바른 배경색을 선택하지 않습니다?
내가 여기에서 놓친 것이 있습니까?
아니요, 이후 onmouserover 및 onmouseout 이벤트가 발생하여 분홍색이되고 흰색이됩니다. –