Hi,
Have a look at this bit of code from 8tans canvas stress-testing.

DynAPI.include('dynapi.api.*');
</script>
<script language="Javascript">
function dowork(){
var a=[];
var start = new Date();
for (var i=0;i<200;i++){
 a[i] = new DynLayer();
 DynAPI.document.addChild(a[i]);
 a[i].moveTo(i*3,i*3);
 a[i].setSize(10,10);
 a[i].setHTML(i);
}
 var end = new Date();
 alert("took " + (end.getTime()-start.getTime()) + " milliseconds.");
}

</script>
</head>

<body bgcolor="#ffffff">
<a href=javascript:dowork()>Start The Test</a>


Hope it helps.
Cheers,
Richard Bennett

[EMAIL PROTECTED]
www.richardinfo.com
(Everything running on, and ported to DynAPI2.53)
visit the DynAPI homepage (and FAQ) ::
http://dynapi.sourceforge.net/dynapi/index.php?menu=1
Browse (and search) the mailinglist here:
http://www.mail-archive.com/index.php3?hunt=dynapi

----- Original Message ----- 
From: "Tom Wilcoxen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 25 June, 2001 19:45
Subject: [Dynapi-Help] create layers in a for loop?


> 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
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> 
> _______________________________________________
> Dynapi-Help mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/dynapi-help
> 


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

Reply via email to