-2

我的页面上有这段代码:

<script type="text/javascript">
    var timeFinal = 3;
    function timeZone(timeBegin,timeEnd) {
        var tz = new Date();
        tz = tz.getTimezoneOffset() / 60;
        timeBegin = timeBegin - tz;
        if (timeBegin <= -1) {
            timeBegin = 24 - timeBegin;
        }
        else {
        }   
        timeFinal = timeBegin + ":" timeEnd;
    }

    function FileModifDate() {
        var dateModif = document.lastModified;
        var startTimeModif = dateModif.indexOf(":") - 2;
        var time = dateModif.substring(startTimeModif, dateModif.length - 3);
        var timeBegin = time.substring(0, 1);
        var timeEnd = time.substring(3, 4);
        var date = dateModif.substring(0, 6);
        date = date.substring(3, 4) + "/" + date.substring(0, 1) + "/" + date.substring(8, 9);
        timeZone(timeBegin,timeEnd);
        dateModif = timeFinal + " " + date;
        document.getElementById('ModifDate').innerHTMl = dateModif;

    }
</script>

但是由于某种原因发生了错误。它在第 21 行显示 Unexpected Identifier:

    timeFinal = timeBegin + ":" timeEnd;

有人可以告诉我有什么问题吗?

4

1 回答 1

2
timeFinal = timeBegin + ":" + timeEnd;

----------------------------------------------^ 你错过了 +这里

在这里修复了代码

于 2013-10-27T05:20:41.297 回答