Computing.Net > Forums > Programming > Possible? (JavaScript)

Possible? (JavaScript)

Reply to Message Icon

Original Message
Name: ksg
Date: June 26, 2004 at 06:57:21 Pacific
Subject: Possible? (JavaScript)
OS: WinXP
CPU/Ram: 1.1/512
Comment:

Hi,

My HTML page has a bunch of INPUT boxes called date1, date2, date3, etc. I'm using PHP to print them because there are a lot and I may change the number of them in the future. Anyway, I'm trying to use this JavaScript code to change the dates all the same...

function setDates(howmany) {
setTo=prompt("Set all dates the same. Use format: YYYY-MM-DD.");
for(i=1; i<=howmany; i++) {
document.bgs.date[i].value=setTo;
}
}

... the problem, as I'm sure you see, is the document.bgs.date[i].value=setTo; line. I just want JavaScript to replace the [i] with the current value of 'i'. How would I do this??? I'm stumped; I don't really know JavaScript.

Thanks a lot.
ksg


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Possible? (JavaScript)

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge