I have calendar.html file it is working fine in IE & crome but in firefox hyperlinks are not active... anyone can please help me ..
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Calendar</title> <script language="JavaScript"> var dDate = new Date(); var dCurMonth = dDate.getMonth(); var dCurDayOfMonth = dDate.getDate(); var dCurYear = dDate.getFullYear(); var objPrevElement = new Object(); var objPrevCalDateText = new Object(); function fToggleColor(myElement) { var toggleColor = "#0000ff"; if (myElement.id == "calDateText") { if (myElement.color == toggleColor) { if (myElement.innerText == dCurDayOfMonth && frmCalendar.tbSelYear.value == dCurYear && frmCalendar.tbSelMonth.value == dCurMonth+1) { myElement.color = "red"; } else { myElement.color = ""; } } else { myElement.color = toggleColor; } } else if (myElement.id == "calCell") { for (var i in myElement.children) { if (myElement.children[i].id == "calDateText") { if (myElement.children[i].color == toggleColor) { if (myElement.innerText == dCurDayOfMonth && frmCalendar.tbSelYear.value == dCurYear && frmCalendar.tbSelMonth.value == dCurMonth+1) { myElement.children[i].color = "red"; } else { myElement.children[i].color = ""; } } else { myElement.children[i].color = toggleColor; } } } } } function fSetSelectedDay(myElement){ if (myElement.id == "calCell") { if (!isNaN(parseInt(myElement.children["calDateText"].innerText))) { myElement.background = "images/cal_cell_down.gif"; objPrevElement.background = "images/cal_cell_up.gif"; document.all.calSelectedDate.value = parseInt(myElement.children["calDateText"].innerText); objPrevElement = myElement; if(frmCalendar.tbSelMonth.value < 10) sMonth = "0" + frmCalendar.tbSelMonth.value else sMonth = frmCalendar.tbSelMonth.value if(myElement.children["calDateText"].innerText < 10) sDay = "0" + myElement.children["calDateText"].innerText else sDay = myElement.children["calDateText"].innerText window.returnValue = sMonth + sDay + frmCalendar.tbSelYear.value window.close(); } } } function fGetDaysInMonth(iMonth, iYear) { var dPrevDate = new Date(iYear, iMonth, 0); return dPrevDate.getDate(); } function fBuildCal(iYear, iMonth, iDayStyle) { var aMonth = new Array(); aMonth[0] = new Array(7); aMonth[1] = new Array(7); aMonth[2] = new Array(7); aMonth[3] = new Array(7); aMonth[4] = new Array(7); aMonth[5] = new Array(7); aMonth[6] = new Array(7); var dCalDate = new Date(iYear, iMonth-1, 1); var iDayOfFirst = dCalDate.getDay(); var iDaysInMonth = fGetDaysInMonth(iMonth, iYear); var iVarDate = 1; var i, d, w; if (iDayStyle == 2) { aMonth[0][0] = "Sunday"; aMonth[0][1] = "Monday"; aMonth[0][2] = "Tuesday"; aMonth[0][3] = "Wednesday"; aMonth[0][4] = "Thursday"; aMonth[0][5] = "Friday"; aMonth[0][6] = "Saturday"; } else if (iDayStyle == 1) { aMonth[0][0] = "Sun"; aMonth[0][1] = "Mon"; aMonth[0][2] = "Tue"; aMonth[0][3] = "Wed"; aMonth[0][4] = "Thu"; aMonth[0][5] = "Fri"; aMonth[0][6] = "Sat"; } else { aMonth[0][0] = "Su"; aMonth[0][1] = "Mo"; aMonth[0][2] = "Tu"; aMonth[0][3] = "We"; aMonth[0][4] = "Th"; aMonth[0][5] = "Fr"; aMonth[0][6] = "Sa"; } for (d = iDayOfFirst; d < 7; d++) { aMonth[1][d] = iVarDate; iVarDate++; } for (w = 2; w < 7; w++) { for (d = 0; d < 7; d++) { if (iVarDate <= iDaysInMonth) { aMonth[w][d] = iVarDate; iVarDate++; } } } return aMonth; } function fDrawCal(iYear, iMonth, iCellWidth, iCellHeight, sDateTextSize, sDateTextWeight, iDayStyle) { var myMonth; myMonth = fBuildCal(iYear, iMonth, iDayStyle); document.write("<table border='0' width='280' cellspacing='0' bordercolorlight='#808080' bordercolordark='#808080'>") document.write("<tr>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][0] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][1] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][2] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][3] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][4] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][5] + "</td>"); document.write("<td align='center' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT: bold'>" + myMonth[0][6] + "</td>"); document.write("</tr>"); for (w = 1; w < 7; w++) { document.write("<tr>") for (d = 0; d < 7; d++) { document.write("<td background='images/cal_cell_up.gif' align='left' valign='top' width='" + iCellWidth + "' height='" + iCellHeight + "' id=calCell style='CURSOR:Hand' onMouseOver='fToggleColor(this)' onMouseOut='fToggleColor(this)' onclick='fSetSelectedDay(this)'>"); if (!isNaN(myMonth[w][d])) { document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:Hand;FONT-FAMILY:Verdana;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick='fSetSelectedDay(this)'>" + myMonth[w][d] + "</font>"); } else { document.write("<font id=calDateText onMouseOver='fToggleColor(this)' style='CURSOR:Hand;FONT-FAMILY:Verdana;FONT-SIZE:" + sDateTextSize + ";FONT-WEIGHT:" + sDateTextWeight + "' onMouseOut='fToggleColor(this)' onclick='fSetSelectedDay(this)'> </font>"); } document.write("</td>") } document.write("</tr>"); } document.write("</table>") } function fUpdateCal(iYear, iMonth) { myMonth = fBuildCal(iYear, iMonth); objPrevElement.bgColor = ""; document.all.calSelectedDate.value = ""; objPrevCalDateText.color = "" for (w = 1; w < 7; w++) { for (d = 0; d < 7; d++) { if (!isNaN(myMonth[w][d])) { if (myMonth[w][d] == dCurDayOfMonth && iYear == dCurYear && iMonth == dCurMonth+1){ calDateText[((7*w)+d)-7].color = "red" objPrevCalDateText = calDateText[((7*w)+d)-7] } calDateText[((7*w)+d)-7].innerText = myMonth[w][d]; } else { calDateText[((7*w)+d)-7].innerText = ""; } } } } </script> <script id=clientEventHandlersJS language=javascript> <!-- function Select1_onblur() { } //--> </script> </head> <body topmargin="0" leftmargin="0"> <script language="JavaScript" for="window" event="onload"> var dCurDate = new Date(); frmCalendar.tbSelMonth.options[dCurDate.getMonth()].selected = true; for (i = 0; i < frmCalendar.tbSelYear.length; i++) if (frmCalendar.tbSelYear.options[i].value == dCurDate.getFullYear()) frmCalendar.tbSelYear.options[i].selected = true; </script> <form name="frmCalendar" method="post" action=""> <input type="hidden" name="calSelectedDate"> <table border="0" cellpadding="0" cellspacing="0" bgcolor="#c0c0c0"> <tr> <td> <select name="tbSelMonth" onchange='fUpdateCal(frmCalendar.tbSelYear.value, frmCalendar.tbSelMonth.value)' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT:normal' id="Select1" onblur="return Select1_onblur()"> <option value="1" selected>January</option> <option value="2">February</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="tbSelYear" onchange='fUpdateCal(frmCalendar.tbSelYear.value, frmCalendar.tbSelMonth.value)' style='FONT-FAMILY:Verdana;FONT-SIZE:12px;FONT-WEIGHT:normal'> <option value="1998">1998</option> <option value="1999">1999</option> <option value="2000">2000</option> <option value="2001">2001</option> <option value="2002">2002</option> <option value="2003">2003</option> <option value="2004">2004</option> <option value="2005">2005</option> <option value="2006">2006</option> <option value="2007">2007</option> <option value="2008">2008</option> <option value="2009">2009</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012" selected>2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> </select> </td> </tr> <tr> <td></td> </tr> <tr> <td> <script language="JavaScript"> <!-- --> var dCurDate = new Date(); fDrawCal(dCurDate.getFullYear(), dCurDate.getMonth()+1, 30, 30, "12px", "normal", 1); fUpdateCal(dCurYear, dCurMonth+1) </script> </td> </tr> </table> </form> </body> </html>
由cor-el于
被采纳的解决方案
You will at least have to use style.color= "#0000ff" instead of color.
Also document.all doesn't work in Firefox, so use getElementById() to address specific elements.
A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.
所有回复 (3)
选择的解决方案
You will at least have to use style.color= "#0000ff" instead of color.
Also document.all doesn't work in Firefox, so use getElementById() to address specific elements.
A good place to ask advice about web development is at the MozillaZine "Web Development/Standards Evangelism" forum.
The helpers at that forum are more knowledgeable about web development issues.
You need to register at the MozillaZine forum site in order to post at that forum.
Thanks for your advice....
You're welcome.