我最近问过这个问题。但是在开始一个新项目之后,我无法弄清楚如何在系统中显示许多业务。有0个企业。如何让p标签显示出来?
<script>var businessesfound = 0; document.getElementById('businessamount').innerHTML = "Business amount:" + businessesfound;</script>
请帮忙!感谢您在其他问题上给予我的所有支持:)
答案 0 :(得分:0)
脚本在定义Tag之前执行,因此JavaScript无法找到它。看一下F12-Tools / Console!
答案 1 :(得分:0)
确保在div标记之后添加脚本标记或在DOM准备好之后运行脚本,如下所示:
$( document ).ready(function() {
var businessesfound = 0;
document.getElementById('businessamount').innerHTML = "Business amount:" + businessesfound;
});
var businessesfound = 0; document.getElementById('businessamount').innerHTML = "Business amount:" + businessesfound;
&#13;
<p id="businessamount"></p>
&#13;