HTML调用Js的函数只显示函数名
程序代码:
function aaa() { var now=new Date(); var year = now.getFullYear(); var now = new Date(); var month = now.getMonth(); var now=new Date(); var day1=now.getDay(); var day; switch(day1) { case 1: day="星期一"; break; case 2: day="星期二"; break; case 3: day="星期三"; break; case 4: day="星期四"; break; case 5: day="星期五"; break; case 6: day="星期六"; break; case 7: day="星期日"; break; } document.write(year); document.write("/"); document.write(month); document.write("/"); document.write(day1); document.write(" "); document.write(day); }
然后调用的语句
<div id="div3">
<a href="#">首页 | </a>
<a href="#">笔记总结 | </a>
<a href="#">资源分享</a>
aaa();
<hr>
</div>