Esse codigo só funciona no IE, mas não no Firefox, alguém sabe qual o problema de ele não funcionar no Firefox? Desde já obrigadaa todos! <html>
<title>Calendário</title>
<body topmargin="0" leftmargin="0" bgcolor=gray>
<script language = javascript>
var as_location, as_tmp, veld = "", format = "", S_formName = "";
as_location = (this.location.search).split("?");
for( i=0; i < as_location.length; i++ ) {
as_tmp = as_location[i].split("=");
if ( as_tmp.length > 1 ) {
if ( as_tmp[0].indexOf("field") > -1 ) {
veld = as_tmp[1];
}
else if ( as_tmp[0].indexOf("format") > -1 ) {
format = as_tmp[1];
}
else if ( as_tmp[0].indexOf("formName") > -1 ) {
S_formName = as_tmp[1];
}
}
}
if ( S_formName.length == 0 ) {
alert( "ERRO: parametro 'formName' faltante.'");
this.close();
}
else
{
veld = eval("parent.window.opener.document." + S_formName + "." + veld);
}
var now = new Date();
var month_array = new Array();
var ano = now.getYear();
var mes = now.getMonth();
mes = mes - 3;
if(mes < 0){
mes = mes + 12;
}
monta_meses();
document.write("<form name=date_list><table bgcolor=#00387D cellspacing='0' cellpadding='4'><tr><td>");
document.write("<select name=month onchange=change_month(this.options.value)>");
for(i=0;i<month_array.length;i++)
{
if (now.getMonth() != mes)
{document.write ("<option value="+mes+">"+month_array[i]);}
else
{document.write ("<option value="+mes+" selected>"+month_array[i]);}
mes = mes + 1;
if(mes > 11){
mes = 0;
}
}
document.write("</select>");
document.write("</td><td>");
document.write ("<select name=year onchange=change_year(this.options[this.options.selectedIndex])>");
for(i=ano-1;i<=now.getYear()+1;i++)
{
if (now.getYear() != i)
{document.write("<option value="+i+">"+i);}
else
{document.write("<option value="+i+" selected>"+i);}
}
document.write("</select></td></tr><tr><td colspan=2><center>");
document.write("<table bgcolor=white border=0 cellspacing = 0 cellpading = 0 width=100% style='cursor:crosshair'><tr bgcolor='#FFCC66' align=center>");
document.write("<td><font face='verdana' color=black><b>S</b></font></td><td><font face='verdana' color=black><b>T</b></td><td><font face='verdana' color=black><b>Q</b></td><td><font face='verdana' color=black><b>Q</b></td><td><font face='verdana' color=black><b>S</b></td><td ><font face='verdana' color=black><b>S</b></td><td ><font face='verdana' color=black><b>D</b></td>");
document.write("</tr><tr>");
for(j=0;j<6;j++)
{
for(i=0;i<7;i++)
{
document.write("<td align=center id=d"+i+"r"+j+" onclick='output(this.innerText)' onmouseover='colorchange(this,this.innerText)' onmouseout='uncolorchange(this,this.innerText)'></td>")
}
document.write("</tr>");
}
document.write("</table>");
document.write("</center></from></td></tr></table>");
var show_date = new Date();
function set_cal(show_date)
{
begin_day = new Date (show_date.getYear(),show_date.getMonth());
begin_day_date = begin_day.getDay();
end_day = new Date (show_date.getYear(),show_date.getMonth()+1);
count_day = (end_day - begin_day)/1000/60/60/24;
if (begin_day.getMonth() == 2) count_day = 31;
else
if (begin_day.getMonth() == 9) count_day = 31;
input_table(begin_day_date,count_day);
}
set_cal(show_date);
function input_table(begin,count)
{
init();
j=0;
if (begin!=0){i=begin-1;}else{i=6;}
for (c=1;c<count+1;c++)
{
colum_name = eval("d"+i+"r"+j);
if ((now.getDate() == c)&&(show_date.getMonth() == now.getMonth())&&(show_date.getYear() == now.getYear())) {colum_name.style.backgroundColor = "#00387D";colum_name.style.color = "white";};
colum_name.innerText = c;
i++;
if (i==7){i=0;j++;}
}
after_init();
}
function init()
{
for(j=0;j<6;j++)
{
for(i=0;i<7;i++)
{
colum_name = eval("d"+i+"r"+j);
colum_name.innerText = "-";
colum_name.style.backgroundColor ="";
colum_name.style.color ="black";
}
}
}
function after_init()
{
for(j=0;j<6;j++)
{
for(i=0;i<7;i++)
{
colum_name = eval("d"+i+"r"+j);
if (colum_name.innerText == "-")
{
colum_name.style.color ="white";
}
}
}
}
function change_month(sel_month)
{
show_date = new Date(show_date.getYear(),sel_month,1);
set_cal(show_date);
}
function change_year(sel_year)
{
sel_year = sel_year.value;
show_date = new Date(sel_year,show_date.getMonth(),1);
set_cal(show_date);
}
function output(date)
{
if (date != "-")
{
month = show_date.getMonth() + 1;
year = show_date.getYear();
day = show_date.getDate();
if (format == 1)
{
//Original
// str_date = month + "/" + date +"/"+ year;
str_date = month + date + year;
}
else
{
//Original
// str_date = date+ "/" + month + "/" + year;
str_date = (date > 9 ? date : "0"+date)+"/" +(month > 9 ? month : "0"+month)+"/" +year;
// str_date = (date > 9 ? date : "0"+date)+(month > 9 ? month : "0"+month)+year;
}
veld.value = str_date;
this.focus();
this.close();
}
}
function colorchange(object,text)
{
if (text != "-")
{
object.style.backgroundColor ="#FFCC66";
}
}
function uncolorchange(object,text)
{
if (text != "-")
{
object.style.backgroundColor = "";
sel_date = new Date (show_date.getYear(),show_date.getMonth(),text);
new_check_date = new Date ();
check_date = new Date (new_check_date.getYear(),new_check_date.getMonth(),new_check_date.getDate());
if ((sel_date - check_date)==0){object.style.backgroundColor = "#00387D";}
}
}
function monta_meses(){
var mes = now.getMonth();
mes = mes - 3;
if(mes < 0){
mes = mes + 12;
ano = ano - 1;
}
for(i=0;i<=11;i++){
if(mes==0){
month_array[i] = "Janeiro";
}else if(mes==1){
month_array[i] = "Feveiro";
}else if(mes==2){
month_array[i] = "Março";
}else if(mes==3){
month_array[i] = "Abril";
}else if(mes==4){
month_array[i] = "Maio";
}else if(mes==5){
month_array[i] = "Junho";
}else if(mes==6){
month_array[i] = "Julho";
}else if(mes==7){
month_array[i] = "Agosto";
}else if(mes==8){
month_array[i] = "Setembro";
}else if(mes==9){
month_array[i] = "Outubro";
}else if(mes==10){
month_array[i] = "Novembro";
}else if(mes==11){
month_array[i] = "Dezembro";
}
mes = mes + 1;
if(mes > 11){
mes = 0;
}
}
}
</script>
</body>
</html>