javascript 为什么只有在点击第一次的时候有效果啊?
<divonclick="mDown(this)"style="background-color:green;color:#ffffff;width:90px;heigh...
<div onclick="mDown(this)"
style="background-color: green; color: #ffffff; width: 90px; height: 60px; padding: 40px; font-size: 12px;">
<div id="t1" style="width: 90px; height: 20px"></div>
<div id="t2" style="width: 90px; height: 20px"></div>
<div id="t3" style="width: 90px; height: 20px"></div>
</div>
<script>
var count = 1;
function mDown(obj) {
if (count == 1)
document.getElementById("t1").innerHTML = "1";
if (count == 2)
document.getElementById("t2").innnerHTML = "2333";
if (count == 3)
document.getElementById("t3").innnerHTML = "2223";
if (count == 4) {
document.getElementById("t1").innerHTML = "";
document.getElementById("t2").innerHTML = "";
document.getElementById("t3").innerHTML = "";
count = 0;
}
count++;
}
</script>
body 中源码 想要让三个div 分别显示三句话啊 展开
style="background-color: green; color: #ffffff; width: 90px; height: 60px; padding: 40px; font-size: 12px;">
<div id="t1" style="width: 90px; height: 20px"></div>
<div id="t2" style="width: 90px; height: 20px"></div>
<div id="t3" style="width: 90px; height: 20px"></div>
</div>
<script>
var count = 1;
function mDown(obj) {
if (count == 1)
document.getElementById("t1").innerHTML = "1";
if (count == 2)
document.getElementById("t2").innnerHTML = "2333";
if (count == 3)
document.getElementById("t3").innnerHTML = "2223";
if (count == 4) {
document.getElementById("t1").innerHTML = "";
document.getElementById("t2").innerHTML = "";
document.getElementById("t3").innerHTML = "";
count = 0;
}
count++;
}
</script>
body 中源码 想要让三个div 分别显示三句话啊 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询