SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: Validating javascript?
-
Dec 1, 2004, 06:45 #1
- Join Date
- Aug 2004
- Location
- Perth, Western Australia
- Posts
- 166
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Validating javascript?
First of all, is it possible to code Javascript in valid XHTML (Transitional)? I'm stuck with validating an encrypted password script. This is the page, and following that is the code in question.
http://www.hexi-decimal.com/locked1.php
Code:<script type="text/javascript"> //Encrypted Password script- By Rob Heslop //Script featured on Dynamic Drive //Visit http://www.dynamicdrive.com function submitentry(){ password = document.password1.password2.value.toLowerCase() username = document.password1.username2.value.toLowerCase() passcode = 1 usercode = 1 for(i = 0; i < password.length; i++) { passcode *= password.charCodeAt(i); } for(x = 0; x < username.length; x++) { usercode *= username.charCodeAt(x); } //CHANGE THE NUMBERS BELOW TO REFLECT YOUR USERNAME/PASSWORD if(usercode==16866649800&&passcode==1714036561020) //CHANGE THE NUMBERS ABOVE TO REFLECT YOUR USERNAME/PASSWORD { window.location=password+".php"} else{ alert("That doesn't seem to be right.")} } </script> <center> <div class="login"> <form name="password1" action=""> Username:<br /> <input type="text" name="username2" size="15" /> <br /><br /> Password:<br /> <input type="password" name="password2" size="15" /> <br /><br /> <input type="button" value="Click" onClick="submitentry()" /> </form> </div> </center>
POSTED WITH CARE BY JORDIE, WEBMISTRESS OF WWW.A-SPLODE.NET
-
Dec 1, 2004, 07:50 #2
Convert the HTML entities back to their normal character representations (i.e. & amp; should just go back to &), then move your script into a separate .js file. Call the file like so:
Code:<script type="text/javascript" src="/encrypt.js"></script>
Bookmarks