Hello
I am really at a loss here. I will try again one more time, but I do not mean to weary you as I am most appreciative of your replies
Getting a value from the database is not a problem. That I can do.
Under normal circumstances one creates a check box using the syntax
<input type=‘checkbox’ …>
I also understand that you can use a for/next loop to create a series of check boxes.
This is not what I am doing. I am using javascript/DOM to create a check box with the following typical syntax
checkbox_one = document.createElement('input');
checkbox_one.setAttribute('id', 'checkbox_one');
checkbox_one.setAttribute('name', 'checkbox_one');
checkbox_one.setAttribute('type', 'checkbox');
checkbox_one.style.position = "absolute";
checkbox_one.style.left = '10px';
checkbox_one.style.top = '10px';
I then go on to attach the code using the syntax
checkboxDiv.appendChild(checkbox_one);
buttonDiv.appendChild(checkboxDiv);
selectDiv.appendChild(buttonDiv);
In this case I need 7 check boxes.
In order to keep going I manually created seven check boxes and all is well.
However, in order to reduce the amount of code required I was looking at using a loop. Also, I would like to be able to determine the number if check boxes automatically so I do not have to revise the code in the event the number (extracted from the database) changes.
As an example
if (name == 'email_list')
{
button_two.setAttribute('value', 'Delete Email');
}
else
{
button_two.setAttribute('value', 'Delete Style');
}
works.
However
for (i=0; i<3; i++ )
{
checkbox[] = document.createElement('input');
checkbox[].setAttribute('id', 'checkbox_seven');
checkbox[].setAttribute('name', 'checkbox_seven');
checkbox[].setAttribute('type', 'checkbox');
checkbox[].style.position = "absolute";
checkbox[].style.left = '200px';
if (i == 0)
{
checkbox[].style.top = '50px';
}
if (i == 2)
{
checkbox[].style.top = '90px';
}
if (i == 2)
{
checkbox[].style.top = '120px';
}
checkbox_span[] = document.createElement('span');
checkbox_span[].style.position = "absolute";
checkbox_span[].style.left = '228px';
checkbox_span[].style.top = '50px';
checkbox_span[].appendChild(document.createTextNode('Test'));
checkboxDiv.appendChild(checkbox_seven[]);
checkboxDiv.appendChild(checkbox_span_seven[]);
}
does not work. Either I have gotten the syntax for check box creation wrong or this idea will not work.
I am trying to find out if my coding is in error or if my thinking on the subject is wrong. I find that in many cases the problem lies in incorrect understanding of a subject, but the trick is finding out which is which.
Regarding the counter I will be happy to post a comment. I am thinking about using a database table rather than a file. We will see. And yes, I understand the issue regarding the number set.
As for my name I tried logging in one time and went to change my password and managed to change my user name also. I intend to go to my profile and set matters straight.
Again, thank you for your kind reply.
Best regards.