我的代码如下所示。当用户单击“下一步”时,我想增加 js 中的计数,并使用固定表达式“文本”和变化变量“计数”的组合作为 var 传递给 innerHTML。我尝试了'text'+count,“'text'+count”等等,这些都没有奏效。有什么建议么?谢谢!!!
<script>
var count = 1
text1 = "feature 1 content"
text2 = "feature 2 content"
text3 = "feature 3 content"
function slideForward()
{
count = count + 1
if (count == 4){
count = 1;}
document.getElementById('featureShow').innerHTML="text"+count ;
}
</script>
<div id="popUpDivFeatures">
<p id="featureShow">feature 1 content</p>
<a href="JavaScript:slideBackward()">Back</a>
<a href="JavaScript:slideForward()">Next</a>
</div>