注册 登录
编程论坛 WEB前端(UI)

HTML调用Js的函数只显示函数名

渐渐鱼 发布于 2018-06-08 20:06, 2086 次点击
程序代码:
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="#">首页&nbsp;&nbsp;|&nbsp;&nbsp;</a>
            <a href="#">笔记总结&nbsp;&nbsp;|&nbsp;&nbsp;</a>
            <a href="#">资源分享</a>
            aaa();
            <hr>
            </div>
1 回复
#2
icecool2018-09-26 11:04

 <div id="div3">
            <a href="#">首页&nbsp;&nbsp;|&nbsp;&nbsp;</a>
            <a href="#">笔记总结&nbsp;&nbsp;|&nbsp;&nbsp;</a>
            <a href="#">资源分享</a>
          <script> aaa();</script>
            <hr>
            </div>
1