TECHNIQUE # 1 -- Creating a textbox so that
1. when the textbox contains n characters, the cursor moves to the next textbox for entry
2. hitting enter will be equivalant to clicking submit
The javascript part
function loginwithpasscode() -- must be onsubmit="return **" ,submits occurs when **=TRUE
{var str,str1,str2;
str1=trim(document.all.passcode1.value);
str2=trim(document.all.passcode2.value);
str="";
str=str1+str2;
if (str.length!=8) {alert(str +"\nEntry must be 8 characters in total.");return false;}
return true;
}
function part1()
{var str;
str=frmpass.passcode1.value;
if (str.length==4) frmpass.passcode2.focus(); -- focus goes to next entry
}
TECHNIQUE # 4 -- GET
<%@ Language=VBScript%>
<%
response.write "ACTION=" & request.querystring("action")
for each item in request.querystring
response.write "| " & item & " | " & request.querystring(item) & " |
" & VbCrLf
next
%>
GET-- can not see action in ?action=send
TECHNIQUE # 5 -- OPENING a new window
function openwindowno(x,y,xfile)
{ var nn, xx,yy;
//kill the previous window if present by windowname.close()
//a window is closed if windowname.closed=true
//check first if windowname was previously created
if (myNew && myNew.open && !myNew.closed) myNew.close();
xx=(screen.width-x)/2; yy=(screen.height-y)/2;
myNew = window.open(xfile, '_blank', 'width='+x+',height='+y+',left='+xx+', top='+yy+',status=yes,toolbar=no,location=no,scrollbars=no,windowpart=yes,resizable=yes')
myNew.focus();
}
TECHNIQUE # 6 -- CHECK valid EMAIL
function validEmail(email)
{ if ((email.indexOf("@")==-1) || (email.indexOf(".")==-1))
{alert("INVALID email address: \""+email+"\""); return false;}
else
return true;
}
TECHNIQUE # 7 -- Javascript TRIM
function trim(strin)
{var str,j,len,i;
len=strin.length;
j=0; i=0;
do {
str=strin.substr(j,1); j++;
if (str==" ") i++;
} while (str==" " && jup to end of string
if (i) strin=strin.substr(i);
//test starting from the last position, one character
//REMOVE 10/13/blanks
len=strin.length; j=len-1;
do {
str=strin.charCodeAt(j);
//alert(str);
if (str==10||str==13||str==32) j--;
} while (str==10||str==13||str==32 && j>0)
//get the substring chopping off the blanks
if (j 0 then
Response.write "error in email
"
sendMail=false
else
response.write "-------> Sending email to:" & toemail & "
"
sendMail=true
end if
else
response.write "LOCAL host,pseudo sent to: " & toemail & "
"
sendMail=true
end if
end function
TECHNIQUE # 9 -- CREATING an OBJECT in Javascript, see events_edit.asp