rndilger Posted December 30, 2008 Share Posted December 30, 2008 Hello, I'm trying to figure out why the following code doesn't work, and I will admit that I'm green when it comes to JS so please bear with me. var chooseIcon = ["a","b","c","d","e,"f","g","h","i"]; var k = 1; for (k=1; k<=chooseIcon.length; k++) { var icon+ k + = new GIcon(); icon+ k +.image = "images/mapmarker"+ k +".gif"; icon+ k +.iconSize = new GSize(12, 12); icon+ k +.iconAnchor = new GPoint(0, 0); icon+ k +.infoWindowAnchor = new GPoint(5, 0); } All I want this code to do is to automate the writing of the following... var icon1 = new GIcon(); icon1.image = "images/mapmarker1.gif"; icon1.iconSize = new GSize(12, 12); icon1.iconAnchor = new GPoint(0, 0); icon1.infoWindowAnchor = new GPoint(5, 0); same thing with 2, 3, etc... I assume it's a simple fix, but I'm stumped at the moment. As always, thanks! Ryan Link to comment https://forums.phpfreaks.com/topic/138871-solved-debug-question-about-for-loop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.