首页 新闻 会员 周边 捐助

document.getElementById(tag)错误

0
悬赏园豆:20 [已解决问题] 解决于 2008-08-25 12:35
<PRE id=line33>&nbsp;。。。<PRE id=line26> &lt;<SPAN class=start-tag>tr</SPAN><SPAN class=attribute-name> align</SPAN>=<SPAN class=attribute-value>"center"</SPAN>&gt; &lt;<SPAN class=start-tag>td</SPAN>&gt; &lt;<SPAN class=start-tag>span</SPAN><SPAN class=attribute-name> id</SPAN>=<SPAN class=attribute-value>"layerCalender"</SPAN>&gt;&lt;/<SPAN class=end-tag>span</SPAN>&gt; </PRE><PRE id=line33> &lt;/<SPAN class=end-tag>td</SPAN>&gt; &lt;/<SPAN class=end-tag>tr</SPAN>&gt; 。。。</PRE></PRE><PRE>&lt;<SPAN class=start-tag>script</SPAN><SPAN class=attribute-name> language</SPAN>=<SPAN class=attribute-value>"javascript" </SPAN><SPAN class=attribute-name>type</SPAN>=<SPAN class=attribute-value>"text/javascript"</SPAN>&gt; &lt;!-- var dayArray=new Array("日","一","二","三","四","五","六"); var monthArray=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; var stringTable="&lt;table cellspacing=\"0\" cellpadding=\"0\" border=\"1\" style=\"align:center;border-color:#8F8FAF;height:100%\" width=\"100%\"&gt;&lt;tr style=\"background-color:#ffffff;align:center\"&gt;"; for (var i=0; i&lt;dayArray.length; ++i) { stringTable+="&lt;td class=\"tdclass\"&gt;&lt;font color=\"#993333\"&gt;&lt;b&gt;"+dayArray[i]+"&lt;/b&gt;&lt;/font&gt;&lt;/td&gt;"; } stringTable+="&lt;/tr&gt;"; function setValue(tag, str) { document.getElementById(tag).innerHTML=str; } function showTime() { var today=new Date(); var currentYear=today.getFullYear() if (((currentYear%4==0)&amp;&amp;(currentYear%100!=0))||(currentYear%400==0)) monthArray[1]=29; var allDays=monthArray[today.getMonth()]; var currentWeek=today.getDay(); var currentDay=today.getDate(); var i=currentDay%7-currentWeek; var threshold=(7+i)%7; var isEnd=false; var stringAll=stringTable; while (true) { if (isEnd) { stringAll+="&lt;td class=\"tdclass\" style=\"background-color:#EEEEEE\"&gt; &lt;/td&gt;"; if (i % 7==(threshold+6)%7) { stringAll+="&lt;/tr&gt;"; break; } } else { if (i % 7==threshold) stringAll+="&lt;tr style=\"align:center\"&gt;"; stringAll+=i&gt;0?"&lt;td class=\"tdclass\""+(i==currentDay?" style=\"background-color:#FEA477;color: #FFFFFF\"":"")+"&gt;&lt;b&gt;"+i+"&lt;/b&gt;&lt;/td&gt;":"&lt;td class=\"tdclass\" style=\"background-color:#EEEEEE\"&gt; &lt;/td&gt;"; if (i % 7==(threshold+6)%7) { stringAll+="&lt;/tr&gt;"; if (i==allDays) break; } if (i==allDays) isEnd=true; } ++i; } stringAll+="&lt;/table&gt;"; setValue("layerYear", currentYear); setValue("layerMonth", today.getMonth()+1); setValue("layerDay", currentDay); setValue("layerWeek", dayArray[currentWeek]); setValue("layerCalendar", stringAll); } showTime() // --&gt; &lt;/<SPAN class=end-tag>script</SPAN>&gt; 请问“layerCalender”对象为什么得不到呢?</PRE>
Qubook的主页 Qubook | 初学一级 | 园豆:0
提问于:2008-08-25 12:25
< >
分享
最佳答案
0
layerCalendar和layerCalender是不一样的……
Gray Zhang | 专家六级 |园豆:17610 | 2008-08-25 12:31
其他回答(1)
0
楼上正解!
TerryLee | 园豆:3300 (老鸟四级) | 2008-08-25 12:34
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册