I have this piece of code in an asp page that I'm trying to edit, and I'm struggling with understanding what this javascript is doing since I know very little about javascript.
Can someone please explain this line by line to help me get a better understanding.
function getInfo(theForm){
var location = "";
for (i=0;i<theForm.length;i++) {
var textbox = theForm.elements;
if (textbox.name == theForm.item.value) {
location = textbox.value;
}
}
if (location.substring(0,1)=="M"){
parent.location.href = location
}
This code is called by another javascript function which is in an onKeyPress event of a form so that when the user presses enter, it acts like it clicked a Continue button:
function manualSubmit(key, theForm){
if (event.keyCode==13) {
event.returnValue = false;
getInfo(theForm);
}
}
TIA!
Can someone please explain this line by line to help me get a better understanding.
function getInfo(theForm){
var location = "";
for (i=0;i<theForm.length;i++) {
var textbox = theForm.elements;
if (textbox.name == theForm.item.value) {
location = textbox.value;
}
}
if (location.substring(0,1)=="M"){
parent.location.href = location
}
This code is called by another javascript function which is in an onKeyPress event of a form so that when the user presses enter, it acts like it clicked a Continue button:
function manualSubmit(key, theForm){
if (event.keyCode==13) {
event.returnValue = false;
getInfo(theForm);
}
}
TIA!