平成30/ 2018-12-19 23:48
javascriptでforeachと同等のことをする
連想配列でも大丈夫!
    var dt = new Array();
    dt["zipcode"] = "";
    dt["pref"] = "";
    dt["city"] = "";
    dt["st_num"] = "";
    dt["name"] = "";
    dt["name_kana"] = "";
    dt["tel"] = "";
    dt["em"] = "";
    dt["em_cfm"] = "";
    dt["hope_way"] = "";
    dt["find_way"] = "";
    dt["find_way_other"] = "";
    
    for (key in dt){
    
        if(
        key == "zipcode"
        ){
            dt[key] = document.getElementById(key + "1").value;
            dt[key] += "" + document.getElementById(key + "2").value;
        } else {
            dt[key] = document.getElementById(key).value;
        }
    }

( Thanks. )
http://kawama.jp/archives/2007/02/javascriptforea.html
var hairetsu = [1,2,3,4,5,6];
for (var i in hairetsu){
alert(i);
}