function Enter_code(number)
// this is a function that interacts with the onClick statement
{
code=code*10+number
// Add the digit to the code
mul=mul*number
// Update mul-value
document.codepad.thecode.value=code
// Show code
digit++
// Increase digit
if (digit==3)
// three digits entered; we see here that
instead of wanting '4' multiples as in the example above
//that in this code it wants only 3 digits;
{
if (mul==10)
//If your 3 digits equal the value of '10' then
{
location=code+".htm"
//open window and goto good-guy page at:
// code+...equals the actual 3 numbers that you have found to be true;
plus add; ".htm"
}
else
//If not true then
{
alert ( document.codepad.thecode.value=mul)
//here is something that I inserted myself; now when I enter numbers
//from the keypad & when the calculation is completed this will
pop
// an alert box showing me what my numbers added up to:
//You'd have to comment out all the else fails statements to avoid errors;
//Its actually much simpler to just use your calculator instead; when it
//equals "10" then .......your a good-guy.....
Note: there are ways to USE alert statements to give U some power answers; I have not learned them yet; look to future essays......:)
fails++
// Increase fails
code=0
// Reset values
mul=1
digit=0
if (fails<3)
//if failure is less than '3' trys then continue in the 'if fails'
loop
{
if (fails==1)
//first failure attempt entering invalid number......
{document.codepad.thecode.value="Try again"} // then
pop this error in codepad user input area
if (fails==2)
// second failure attempt at entering invalid number......
{document.codepad.thecode.value="Last time"} //then
pop this error instead of printing "Try again"
}
else
//
//failure attempt on third try....print.... "Bye!"
{
location="thishell.htm"
// Then open window and goto bad-guy page
document.codepad.thecode.value="Bye!"
}
}
}
}
function keycodepad(mulcode)
//This is associated with function Enter_code(number)
above
{
usermulcode=mulcode
document.write("<form name=\"codepad\">");
document.write("<input type=\"button\"
value=\" 1 \" onClick=\"Enter_code(1)\">"); //creates
#1 button; interacts
//with Enter_code function
// when clicked
document.write("<input type=\"button\"
value=\" 2 \" onClick=\"Enter_code(2)\">"); //#2
button...ect
document.write("<input type=\"button\"
value=\" 3 \" onClick=\"Enter_code(3)\"><br>");
document.write("<input type=\"button\"
value=\" 4 \" onClick=\"Enter_code(4)\">");
document.write("<input type=\"button\"
value=\" 5 \" onClick=\"Enter_code(5)\">");
document.write("<input type=\"button\"
value=\" 6 \" onClick=\"Enter_code(6)\"><br>");
document.write("<input type=\"button\"
value=\" 7 \" onClick=\"Enter_code(7)\">");
document.write("<input type=\"button\"
value=\" 8 \" onClick=\"Enter_code(8)\">");
document.write("<input type=\"button\"
value=\" 9 \" onClick=\"Enter_code(9)\"><br>");
document.write("<input type=\"text\"
name=\"thecode\" size=10 value=\"\"><br>");
document.write("</form>");
}
// Key-code script by Bart Jellema -->
// Key-code script commented by Jeffrrrreeeeeeeeeeeeeeeeeey!
Oh sh*t; gotta go.....
</SCRIPT>
<TITLE></TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF"> //background
color
<center>
<script>
keycodepad(24)
</script>
</center>
<P>
Please enter the code:
//text diasplayed in window informing you what to do......
</BODY>
</HTML>
Regards to The Sandman who's efforts to build a network of various
studies for newbies is unsurpassed; and whos
friendship and tutelage are also unsurpassed!
and to our new friend and JavaTeacher "The Seeker"; whos encouragement
and selfless efforts are taking us to new
dimensions!
Respects also to fravia+ for providing such valuable resources for
our studies; Thank You!
Greetz to tnwo, Dogbytes; snake; Eternal Bliss; Bjanes;
Volatility, Nick, Ice, Princess, and to all others; ya know who ya all
are!
Jeff
2/24/99