Microsoft
Software
Hardware
Network
Question : javascript
Hello i have 5 textbox with the same name , the only thing that change is the number at the end of the name
let say:
document.Invoice.txtName1.
value
document.Invoice.txtName2.
value
document.Invoice.txtName3.
value
how can i just change the number for a variable:
something like
var x = 1;
document.Invoice.txtName(x
).value
document.Invoice.txtName(x
).value
document.Invoice.txtName(x
).value
so i can run a for 3 times and don,t have to write all the code for each field.
Answer : javascript
use the id attribute for this
<input type="text" id='txt1'>
<input type="text" id='txt2'>
<input type="text" id='txt3'>
for ( var counter = 1; counter <= 3; counter++ )
{
alert(document.getElementB
yId("txt" + counter ).value);
}
Random Solutions
Mail Aliases redirected to Public Folder
copying long file names
Convert Test field to Number field in make table query
Installed VMware Server 1, now OWA & Outlook Anywhere doesn't work
Error assigng data to a list view
Remote Desktop Server 2003 Group Policy and Server 2008
Display records from two tables, one table missing records
TTL Expired periodically on a ping to another subnet.
disable default "CURRENT_TIMESTAMP" field when executing UPDATE query
Is it possible to put a frequently used document in the system tray to open quickly?