<script language=javascript>
function test_loop_var(){
var item1_Username, item2_Username, item3_Username, item4_Username, item5_Username;
for (var i=1; i<=5; i++) {
eval("item" + i + "_Username = 'test" + i + "';"); //設值
}
var test_str = "";
for (var i=1; i<=5; i++) {
test_str = eval("item" + i + "_Username"); //取值
alert(test_str); //alert顯示5次,各顯示test1、test2、test3、test4、test5
}
}
</script>
全站熱搜
留言列表