JavaScript_循环26个英文字母的方法 .

小白方法:

<script type="text/javascript">
<!--
var character = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","X","Y","Z");
for(var i=0;i<25;i++)
{
alert(character[i]);
}
// -->
</script>

 

2b青年方法:

<script type="text/javascript">
<!--
for(var i=0;i<25;i++)
{
alert(String.fromCharCode((65+i)));
}
// -->
</script>

posted @ 2012-09-03 09:15  赤狐(zcm123)  阅读(405)  评论(0编辑  收藏  举报