gilly
Aug 24th, 2000, 07:39 AM
I have the following code (which works) for selecting a checkbox in javascript, which then allows me to edit a row from a table.
HOWEVER I now have a new edit function for a combobox, and therefore need to change my javascript code.Im unsure of the correct syntax/format for doing this..
heres my code below for the checkbox: CAN ANYONE CONVERT THIS TO WORK FOR A COMBO BOX.....much appreciated.
function btnedit_onclick() {
var i, checkedcount = 0, straddress
for (i=0; i < document.form1.length; i++){
var e = document.form1.elements[i];
if (e.type == "checkbox") {
if (e.selected){
checkedcount=checkedcount+1;
}
}
}
if (checkedcount > 1) {
alert("You can only select one record to edit!")
return;
}
if (checkedcount == 0) {
alert("You must select a record to edit!")
return;
}
else {
for (i=0; i < document.form1.length; i++){
var e = document.form1.elements[i];
if (e.type == "checkbox") {
if (e.checked){
editchk=e.name.substr(5);
}
}
}
straddress = 'editstandardjourney.asp?' +
'chkid=' + editchk +
'&UserID=<%=strUserID%>'
window.location = straddress
} //End Else
} //End Function
HOWEVER I now have a new edit function for a combobox, and therefore need to change my javascript code.Im unsure of the correct syntax/format for doing this..
heres my code below for the checkbox: CAN ANYONE CONVERT THIS TO WORK FOR A COMBO BOX.....much appreciated.
function btnedit_onclick() {
var i, checkedcount = 0, straddress
for (i=0; i < document.form1.length; i++){
var e = document.form1.elements[i];
if (e.type == "checkbox") {
if (e.selected){
checkedcount=checkedcount+1;
}
}
}
if (checkedcount > 1) {
alert("You can only select one record to edit!")
return;
}
if (checkedcount == 0) {
alert("You must select a record to edit!")
return;
}
else {
for (i=0; i < document.form1.length; i++){
var e = document.form1.elements[i];
if (e.type == "checkbox") {
if (e.checked){
editchk=e.name.substr(5);
}
}
}
straddress = 'editstandardjourney.asp?' +
'chkid=' + editchk +
'&UserID=<%=strUserID%>'
window.location = straddress
} //End Else
} //End Function