View Single Post
Old 11-29-2011, 03:53 AM   PM User | #4
drakerehfeld
New Coder

 
Join Date: Jun 2011
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
drakerehfeld is an unknown quantity at this point
I actually have a problem in my code. Can you help? I used a standard code from someone else.
  • I dont like that they can't press enter, but rather have to click OK. How do I code it so that pressing enter clicks ok?
  • Is there a way to make the link open in a new window? When they click OK, it opens a new window with thier account?
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english"> 
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title>Login</title>
<script type="text/javascript">

function init() {

/*******account numbers******/

   numbers=[          
            'gfillinger','rcoleman','taday',
            'drehfeld62','drehfeld60','drehfeld97',
           ]; 

/*************************************************************/

   df=document.forms[0];
   df[0].focus(); 

df[0].onkeyup=function(){
   this.value=this.value.toLowerCase();
 }

   df[1].onclick=function() {


for(c=0;c<numbers.length;c++) {
if(numbers[c]==df[0].value) {   
   location.href=df[0].value+'.html';
   return;
  }
 }

if(numbers[c]!=df[0].value) {
alert('This username is invalid.\n\nPlease correct your username (format: firstinitiallastname; example: jsmith)');
   df.reset();
   df[0].focus();
   return;
   }
  }
 }

if(window.addEventListener){
   window.addEventListener('load',init,false);
 }
else { 
if(window.attachEvent){
   window.attachEvent('onload',init);
  }
 }

</script>

</head>
<body>

<form action="#">
<div id="container">
<h1></h1>
<input type="text">
<input type="button" value="OK">
</div>
</form>

</body>
</html>
Thanks
PS sorry for being such a n00b. :P

Last edited by drakerehfeld; 11-29-2011 at 03:57 AM..
drakerehfeld is offline   Reply With Quote