Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
Thread: calculate with generated names
05-29-2004, 10:00 PM #1
- Join Date
- May 2004
- Thanked 0 Times in 0 Posts
calculate with generated names
First I'll try to explain what I want to achieve.
I want to make a calculator for the total duration of a CD.
When the page loads, you can choose with a <SELECT>-tag how much songs there are on the CD.
When you select 12 the script generates 12 rows with on each row 2 <INPUT>-tags, the first for the minutes, the other for the seconds. So far no problems.
At the bottom of the page, I put a button to calculate the total time on that CD. I created the right formulas, which works fine.
Here comes the problem:
I tried to give the generated <INPUT>-tags all a different name so I can use those names in the calculations, but I can't get it right.
The HTML-code looks like this:
Number of Songs on CD:
<SELECT size=1 name=number onChange="createList(counter.number.value); showtable();">
<OPTION value=1 selected>01</OPTION>
<TR><TD colspan=3 align=center height=50 valign=bottom><SPAN id=but></SPAN></TD></TR>
<TR><TD colspan=3 align=center height=50 valign=bottom><SPAN id=tot></SPAN></TD></TR>
The generated <INPUT>-tags looks like this:
<INPUT type='text' size=2 maxlength=2 name=" + inter + "min" + I + inter + "'>
inter="'"; and "I" is a number so when it works as I want, there should be created a name like this: "min02" or "min13".
I only need to know if the generated names will work this way and how I can use them in my calculate function.
Can anybody help me please?
Sorry for the bad English, but keep in mind I live in the Netherlands.