function showtime() { alert("a"); var now_time = new Date(); var hours = now_time.getHours(); var minutes = now_time.getMinutes(); var seconds = now_time.getSeconds(); var timer = "" + (( hours>12) ? hours-12 : hours); // timer += ((minutes < 10) ? ":0" : ":") + minutes; // timer += ((seconds < 10) ? ":0" : ":") + seconds; // timer += " " + ((hours > 12) ? "pm" : "am"); // document.clock.show.value = timer; // setTimeout("showtime()",1000); }
这段代码是书本上的照抄的,js执行到红色部分出错。新手上路,大佬们帮看看,谢谢
代码里有中文输入法的括号
谢谢大佬,问题解决!