JSP中引用javascript乱码问题

 function getCurrentTime()
{
 var today = new Date();
 var year = today.getFullYear();
 var month = today.getMonth();
 var day = today.getDay();
 var s=["日","一","二","三","四","五","六"];
 document.write(year+"年"+month+"月"+day+"日"+"星期"+s[day]);
}

jsp:

........<span style="clear: both; margin-left: 1050px;">今天是:<script>getCurrentTime()</script>
     </span>

.......

出现乱码问题,是在引用JS时,没有进行编码设置,<script language="javascript" src="js/stu.js" charset="utf-8"></script>

编码方式要与JSP页面的编码字符一样。。。


原文链接: http://blog.csdn.net/weiyirong/article/details/7332893

你可能感兴趣的:(JSP中引用javascript乱码问题)