我的代码只给出了最后一个字母,例如:i < 90;
它只提供字母&#39; z&#39;
<body>
<div id="div1" ></div>
<script src="jquery-3.1.0.js" type="text/javascript"></script>
<script>
for (i = 65; i < 99; i++) {
var str[]=String.fromCharCode(i);
$("#div1").html("str");
}
</script>
</body>
答案 0 :(得分:0)
试试这个 -
<body>
<div id="div1" ></div>
<script src="jquery-3.1.0.js" type="text/javascript"></script>
<script>
for (i = 65; i < 99; i++) {
var tmpVal = $("#div1").text();
var str =String.fromCharCode(i);
$("#div1").text(tmpVal+" "+str);
}
</script>
</body>