You might want to re-read some docs on how eval() works. Here's an untested 
rewrite:

for (var i = 0; i < o.items.length; i += 2){
    var tempLayer = new DynLayer();
    var linkItem = '<a href="' + o.items[i] + '">'+ o.items[i + 1] +'</a>';
    tempLayer.setHTML(linkItem);
    tempLayer.setVisible(true);
    o.menuItems.addChild(tempLayer);
   }

-Anarchos

----Original Message Follows----
From: Tom Wilcoxen <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: [Dynapi-Help] create layers in a for loop?
Date: Mon, 25 Jun 2001 10:45:38 -0700 (PDT)

I need to create a number of layers in a for loop. This is what I've
been trying (with many variations):

   for (i=0; i<o.items.length; i=i+2){
    eval("i") = new DynLayer();
    linkItem = "<a href='" + o.items[i] + "'>" + o.items[i+1] + "</a>";
    eval("i").setHTML(linkItem);
    eval("i").setVisible(true);
    o.menuItems.addChild( eval("i") );
    o.menuItems.eval("i").setVisible(true);
   }

I get the error: "can't assign to a function" from the second line
above. I just want a group of layers created on the fly depending on
how many items are in the "items" array. I think I must be missing
something -- is this the wrong approach?

Thanks!
-Tom
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to