I have a 'hard' question..I think...here it is..
I am capturing the "enter" keystroke on a page with a few different forms...basically, I dont want people to be able to use the "enter" key to hit/submit things..they have to use buttons>>>EXCEPT when they are in a textarea/textbox area....
now, this script needs to work across multiple pages (dynamic) with multiple "forms" on each page..
so,,,,is there a way to "check for generic" forms (all of them) on a page, see if a 'textarea/textbox' is focused -- I guess that means its active..and if someone clicks enter at that point...it works...
in other words, capturing the 'enter' keystroke under all condition except that noted above..here is what I have so far....I put it into a js file..
function validateDelete(){
if(confirm("You are about to DELETE database entries!\n Is this what you intend?")){
return true;
}else{return false}
}
//this function captures the keyevent for enter and nullifies it
netscape = "";
count=0;
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
netscape = (ver.charAt(iln+1).toUpperCase() != "C");
function keyDown(DnEvents) { // handles keypress
if(form
// determines whether Netscape or Internet Explorer
k = (netscape) ? DnEvents.which : window.event.keyCode;
if (k == 13) { // enter key pressed
if(count==0){alert('Enter Key is disabled, please click submit button')}
count++;
return false;
}
}
document.onkeydown = keyDown; // work together to analyze keystrokes
if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
//-->
I am capturing the "enter" keystroke on a page with a few different forms...basically, I dont want people to be able to use the "enter" key to hit/submit things..they have to use buttons>>>EXCEPT when they are in a textarea/textbox area....
now, this script needs to work across multiple pages (dynamic) with multiple "forms" on each page..
so,,,,is there a way to "check for generic" forms (all of them) on a page, see if a 'textarea/textbox' is focused -- I guess that means its active..and if someone clicks enter at that point...it works...
in other words, capturing the 'enter' keystroke under all condition except that noted above..here is what I have so far....I put it into a js file..
function validateDelete(){
if(confirm("You are about to DELETE database entries!\n Is this what you intend?")){
return true;
}else{return false}
}
//this function captures the keyevent for enter and nullifies it
netscape = "";
count=0;
ver = navigator.appVersion; len = ver.length;
for(iln = 0; iln < len; iln++) if (ver.charAt(iln) == "(") break;
netscape = (ver.charAt(iln+1).toUpperCase() != "C");
function keyDown(DnEvents) { // handles keypress
if(form
// determines whether Netscape or Internet Explorer
k = (netscape) ? DnEvents.which : window.event.keyCode;
if (k == 13) { // enter key pressed
if(count==0){alert('Enter Key is disabled, please click submit button')}
count++;
return false;
}
}
document.onkeydown = keyDown; // work together to analyze keystrokes
if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);
//-->
Comment