[JavaScript] Value Enter Issue
one of my friend mailed me about this help and i could not help him. please save this as .htm and pls tell what value should be entered in the Textbox to get the Alert Correct
Code:
<html>
<head>
<title>Solve It</title>
</head>
<body>
<center><h1>Can You?</h1></center>
<script language="JavaScript">
function chkcode(pass)
{
var temp = 0;
var alpha = "abcdefghijklmnopqrstuvwxyz";
var char1;
for (i = 0; i < pass.length; i++)
{
char1 = pass.charAt(i);
buf = (alpha.indexOf(char1));
buf += 1;
temp *= 26;
temp += buf;
}
if(temp == 913216169672)
{
alert("correct");
document.write("<h1><center>Congratulations");
load(pass);
}
else
alert("try again");
}
function load(pass)
{
document.write ("<a href =" + pass + ".html><h4>Next</h4></a>");
}
</script>
<br><br><br><br><br><br><br><br><br><br>
<form method=post name="f1"
onSubmit="chkcode(document.f1.name.value)">
<b><center>Enter Access Code</b><input type="text" name="name" size="25">
<input type="submit" value= "submit" ></center>
</form>
</body>
</html>
Re: [JavaScript] Value Enter Issue