Results 1 to 2 of 2

Thread: [JavaScript] Value Enter Issue

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    [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>

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: [JavaScript] Value Enter Issue

    Moved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width