javascript设计如下界面,在点击启动时钟时,每隔1秒来回显示“四川大学"和“清华大学”,点击停止时钟时,停止来回显示。
我不知道怎么让它个一秒就切换 不知道要用那个公式
txt1.value = now
改成
txt1.value == x ? txt1.value =y : txt1.value =x
//多声明一个变量
var type =0
function change(){
//把这些补充到你的那个里面
txt1.value=(type%2)===0?x:y
type++
}
清掉定时器的时候 把type重置为0
嗯楼上那个 更简单 思路一样的