mw2005
08-02-2005, 09:57 AM
I have a set of 5 text boxes which the user can only enter 5 characters into each box. How can i make a text link which once they have entered in all of the information into the boxes it checks if it is correct. If the 25characters are right (it checks it with 25 charcters which are in the script you get redirected to a diferent page.
I think it might be something to do with an IF function (if this is correct do this if it is not do this).
Any help will be appreciated:
This is waht i have so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<HTA:APPLICATION
WINDOWSTATE="maximize"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
CONTEXTMENU="no"
minimizeButton=yes
maximizeButton=yes
scroll=yes
innerBorder=yes
icon="no"
></HTA:APPLICATION>
<title></title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site: http://members.xoom.com/cyanide_7 -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
</script>
<style type="text/css">
body, html {
height: 100%;
width: 100%;
overflow: hidden;
font: 11pt Verdana;
}
body {
background-color: #fff;
}
p {
margin:0;
}
#header {
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-right: -300px;
margin-top: -120px;
width: 630px;
height: 19px;
background: #3300cc;
border: 1px black solid;
color: lightyellow;
font-weight: bold;
z-index: 1;
}
#content {
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-top: -120px;
width: 600px;
height: 200px;
overflow: auto;
margin-right: -300px;
border: 1px black solid;
background: white;
color: black;
padding: 15px;
z-index: 0;
}
</style>
</head>
<body>
<div id="header"><p align=center>Key</p></div>
<div id="content"><p align=center><br><br>Enter your key</p> <p><center>
<form name="id">
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
</form>
<body onload="document.id.reset()">
</center></p>
<p> </p>
<p align="right"><br><br></p>
<p align=right><font size="1">Where is my Product Key?</font></p></div>
</body>
</html>
I think it might be something to do with an IF function (if this is correct do this if it is not do this).
Any help will be appreciated:
This is waht i have so far:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html>
<head>
<HTA:APPLICATION
WINDOWSTATE="maximize"
SHOWINTASKBAR="no"
SINGLEINSTANCE="yes"
CONTEXTMENU="no"
minimizeButton=yes
maximizeButton=yes
scroll=yes
innerBorder=yes
icon="no"
></HTA:APPLICATION>
<title></title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Cyanide_7 (leo7278@hotmail.com) -->
<!-- Web Site: http://members.xoom.com/cyanide_7 -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode;
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
</script>
<style type="text/css">
body, html {
height: 100%;
width: 100%;
overflow: hidden;
font: 11pt Verdana;
}
body {
background-color: #fff;
}
p {
margin:0;
}
#header {
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-right: -300px;
margin-top: -120px;
width: 630px;
height: 19px;
background: #3300cc;
border: 1px black solid;
color: lightyellow;
font-weight: bold;
z-index: 1;
}
#content {
position: absolute;
top: 50%;
left: 50%;
margin-left: -300px;
margin-top: -120px;
width: 600px;
height: 200px;
overflow: auto;
margin-right: -300px;
border: 1px black solid;
background: white;
color: black;
padding: 15px;
z-index: 0;
}
</style>
</head>
<body>
<div id="header"><p align=center>Key</p></div>
<div id="content"><p align=center><br><br>Enter your key</p> <p><center>
<form name="id">
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
<small><input onKeyUp="return autoTab(this, 5, event);" size="5" maxlength="5"></small>
</form>
<body onload="document.id.reset()">
</center></p>
<p> </p>
<p align="right"><br><br></p>
<p align=right><font size="1">Where is my Product Key?</font></p></div>
</body>
</html>