单击我的测试和放大器上的按钮时,p id="demo"
内容不会切换托管环境。不知道为什么?我认为代码是正确的吗?
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
function myWhen() {
document.getElementById("demo").innerHTML = "when-Estimated time to complete is Fall 2016.";
}
</script>
</head>
<body>
<ul>
<li><button onclick="myWhen()"><p>WHEN?</p></button></li>
</ul>
<div class="textbox">
<p id="demo">A Paragraph Written<br>Another line here</p>
</div>
</body>
</html>
答案 0 :(得分:1)
你的代码是对的&amp;它正在工作。 在这里查看你的结果..
function myWhen() {
document.getElementById("demo").innerHTML = "when-Estimated time to complete is Fall 2016.";
}
<ul>
<li><button onclick="myWhen()"><p>WHEN?</p></button></li>
</ul>
<div class="textbox">
<p id="demo">A Paragraph Written<br>Another line here</p>
</div>