HTML写的时间,正常打开没问题,使用网页框控件打开出现乱码情况。直接在浏览器打开正常打开。在网页框中打开,出现中文乱码。<html> <head> <meta http-equiv="Content-Type” content="text/html; charset=gb2312"> <script type="text/javascript"> var days=new Array ("日", "一", "二", "三", "四", "五", "六"); function showDT() { var currentDT = new Date(); var y,m,date,day,hs,ms,ss,theDateStr; y = currentDT.getFullYear(); //四位整数表示的年份 m = currentDT.getMonth()+1; //月 date = currentDT.getDate(); //日 day = currentDT.getDay(); //星期 hs = currentDT.getHours(); //时 if(currentDT.getMinutes()>=0&¤tDT.getMinutes()<10) { ms = "0"+currentDT.getMinutes(); } else { ms = currentDT.getMinutes(); }; if(currentDT.getSeconds()>=0&¤tDT.getSeconds()<10) { ss = "0"+currentDT.getSeconds(); } else { ss = currentDT.getSeconds(); }; theDateStr =y+"年"+m+"月"+date+"日 "+" "+hs+":"+ms+":"+ss; document.getElementById("theClock"). innerHTML =theDateStr; // setTimeout 在执行时,是在载入后延迟指定时间后,去执行一次表达式,仅执行一次 window.setTimeout( showDT, 1000); } </script> </head> <body onload="showDT()"> <FONT face=黑体(字体) Color = red size=6.5><div id="theClock"></div> </FONT></body> </html