ckl
Newbie
Posts: 1
Registered: 8/3/2004
Member Is Offline
|
| posted on 8/3/2004 at 07:52 PM |
|
|
Creating a Loop for multiple calendars
I am trying to create a loop to create multiple calendars 25+
The only section of code I am having trouble with it that below the form tag
I currently have 3 calenders working with the follwing code :
<script language="JavaScript">
var cal1000 = new calendar2(document.forms['frmNew'].elements[ecdt1000]);
var cal1001 = new calendar2(document.forms['frmNew'].elements[ecdt1001]);
var cal1002 = new calendar2(document.forms['frmNew'].elements[ecdt1002]);
</script>
Above is expandable to infine number of calenders, but impracticle. I am using a database value to control the number of loop iterations
My attempt is below. The error I assume is in the second line starting with var calname...
(the alert allows me to verify the variables are correctly incrementing)
<script language="JavaScript">
for (i = 1000; i <= 1002; i++)
{
var calname = "cal" + i;
var inputname = "ecdt" + i;
alert("Name: " + calname + " inputname: " + inputname)
var calname = new calendar2(document.forms['frmNew'].elements[inputname]);
}
</script>
I need to be able to "declare/create" a new calendar and set the name to my variable 'calname' . The 'inputname'
variable is working correctly - i have trested this in substitution with the code above. Any help would be appreciated - my javascript is rusty.
Thanks,
CKL
|
|
|
|