首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

一个日历代码,这论坛上找到的,只能在IE下面用,FF不行,可惜小弟我看不懂这段代码,所以请大大们帮小弟我看下

2012-02-12 
一个日历代码,这论坛上找到的,只能在IE下面用,FF不行,可惜我看不懂这段代码,所以请大大们帮我看下应该怎么

一个日历代码,这论坛上找到的,只能在IE下面用,FF不行,可惜我看不懂这段代码,所以请大大们帮我看下
应该怎么改才能在FF下面用?
<input   type= "text "   name= "birthday "   onfocus= "javascript:show_cele_date(birthday, ' ', ' ',birthday) ">
<script   language= "javascript ">      
var   date_start,date_end,g_object;
var   today=new   Date();
var   separator= "- ";
var   inover=false;      
//mode       :时间变换的类型0-年       1-月       2-直接选择月      
function   change_date(temp,mode)
{      
var   t_month,t_year;      
if(mode)
{      
if(mode==1)      
t_month=parseInt(cele_date_month.value,10)+parseInt(temp,10);      
else      
t_month=parseInt(temp)      

if(t_month <cele_date_month.options(0).text)
{      
cele_date_month.value=cele_date_month.options(cele_date_month.length-1).text;      
change_date(parseInt(cele_date_year.value,10)-1,0);      
}      
else
{      
if(t_month> cele_date_month.options(cele_date_month.length-1).text)
{      
cele_date_month.value=cele_date_month.options(0).text;      
change_date(parseInt(cele_date_year.value,10)+1,0);      
}                                                      
else      
{
cele_date_month.value=t_month;      
set_cele_date(cele_date_year.value,cele_date_month.value);                                                                      
}      
}      
}              
else
{      
t_year=parseInt(temp,10);      
if(t_year <cele_date_year.options(0).text)
{      
cele_date_year.value=cele_date_year.options(0).text;      
set_cele_date(cele_date_year.value,1);                                                                      
}      
else
{      
if(parseInt(t_year,10)> parseInt(cele_date_year.options(cele_date_year.length-1).text,10))
{      
cele_date_year.value=cele_date_year.options(cele_date_year.length-1).text;      
set_cele_date(cele_date_year.value,12);                                                                      
}                                                      
else      
{
cele_date_year.value=t_year;      


set_cele_date(cele_date_year.value,cele_date_month.value);                                                                      
}      
}      
}      
/*********2002-02-01       MODIFY       BY       WING       **************/      
window.cele_date.focus();      
/****************MODIFY       END***********************/      
}      
       
//初始化日历      
function   init(d_start,d_end)      
{      
var   temp_str;      
var   i=0;
var   j=0;      
date_start=new   Date(1980,7,1);      
date_end=new   Date(2004,8,1);      
document.writeln( " <div       name=\ "cele_date\ "       id=\ "cele_date\ "           style=\ "display:none\ "                   style=\ "LEFT:       69px;       POSITION:       absolute;       TOP:       159px;Z-INDEX:99\ "       onClick=\ "event.cancelBubble=true;\ "       onBlur=\ "hilayer()\ "       onMouseout=\ "lostlayerfocus()\ "> - </div> ");      
window.cele_date.innerHTML= " ";      
temp_str= " <table       border=\ "1\ "       bgcolor=\ "#DDDDDD\ "       bordercolor=\ "white\ "> <tr> <td       colspan=7       onmouseover=\ "overcolor(this)\ "> ";      
temp_str+= " <input       type=\ "Button\ "       value=\ " < <\ "       onclick=\ "change_date(-1,1)\ "       onmouseover=\ "getlayerfocus()\ "       style=\ "color:       #000099;       background-color:       #BFBFBF;       cursor:       hand\ "> - ";      
temp_str+= " "      
temp_str+= " <select       name=\ "cele_date_year\ "       id=\ "cele_date_year\ "       language=\ "javascript\ "       onchange=\ "change_date(this.value,0)\ "       onmouseover=\ "getlayerfocus()\ "       onblur=\ "getlayerfocus()\ "       style=\ "font-size:       9pt;       border:       1px       #666666       outset;       background-color:       #F4F8FB\ "> "      
for(i=1900;i <=2020;i++)      
{      
temp_str+= " <OPTION       value=\ " "+i.toString()+ "\ "> "+i.toString()+ " </OPTION> ";      
}      
temp_str+= " </select> - ";      


temp_str+= " "      
temp_str+= " <select       name=\ "cele_date_month\ "       id=\ "cele_date_month\ "       language=\ "javascript\ "       onchange=\ "change_date(this.value,2)\ "       onmouseover=\ "getlayerfocus()\ "       onblur=\ "getlayerfocus()\ "       style=\ "font-size:       9pt;       border:       1px       #666666       outset;       background-color:       #F4F8FB\ "> "      
for(i=1;i <=12;i++)      
{      
temp_str+= " <OPTION       value=\ " "+i.toString()+ "\ "> "+i.toString()+ " </OPTION> ";      
}      
temp_str+= " </select> - ";      
temp_str+= " "      
temp_str+= " <input       type=\ "Button\ "       value=\ "> > \ "       onclick=\ "change_date(1,1)\ "       onmouseover=\ "getlayerfocus()\ "           style=\ "color:       #000099;       background-color:       #BFBFBF;       cursor:       hand\ "> ";      
temp_str+= " </td> </tr> <tr> <td       onmouseover=\ "overcolor(this)\ "> "      
temp_str+= " <font       color=red> 日 </font> </td> <td> ";temp_str+= "一 </td> <td> ";       temp_str+= "二 </td> <td> ";       temp_str+= "三 </td> <td> "      
temp_str+= "四 </td> <td> ";temp_str+= "五 </td> <td> ";       temp_str+= "六 </td> </tr> ";      
for(i=1       ;i <=6       ;i++)      
{      
temp_str+= " <tr> ";      
for(j=1;j <=7;j++)
{      
temp_str+= " <td       name=\ "c "+i+ "_ "+j+ "\ "id=\ "c "+i+ "_ "+j+ "\ "       style=\ "CURSOR:       hand\ "       style=\ "COLOR:#000000\ "       language=\ "javascript\ "       onmouseover=\ "overcolor(this)\ "       onmouseout=\ "outcolor(this)\ "       onclick=\ "td_click(this)\ "> ? </td> "      
}      
temp_str+= " </tr> "                                      
}      
temp_str+= " </td> </tr> </table> ";      
window.cele_date.innerHTML=temp_str;      
}

[解决办法]
要改的话,工作量还是不小的
[解决办法]
是啊,建议换其它的吧,写的时候不注意,那改起来可就难了!
------解决方案--------------------


JF

热点排行