Problem in keypress()

  • rhodarose
  • Born
  • Born
  • rhodarose
  • Posts: 2

Post 3+ Months Ago

Good Day!

I created a webpage and it consist of Username, Department, and a submit button. the username is a textfield type and the department is a select option type. I want that when i am done in inputting my username and i press the enter, the select option would be hide so that i can choose my department and when i am done in choosing my department and i press the enter i automatically link to the my designated department. I hope you can help me in my problem

Here is my code:

Code: [ Select ]
<head>

<script> 

   function onKeyEnter(e) { 

     var ENTER_KEY = 13; 

     var code = ""; 

     

     if (window.event){ // IE 

       code = e.keyCode; 

     }else if (e.which){ // Netscape/Firefox/Opera 

       code = e.which; 

     } 

        

     if (code == ENTER_KEY) { 

       formname.select.focus() 

     } 

</script>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
BODY {
background-image: url(layout_image/bgroundv03.png);
background-attachment: fixed;
}
#Layer1 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:1;
    left: 82px;
    top: 95px;
}
#Layer2 {
    position:absolute;
    width:229px;
    height:49px;
    z-index:1;
    left: 441px;
    top: 262px;
}
#Layer3 {
    position:absolute;
    width:186px;
    height:32px;
    z-index:2;
    left: 452px;
    top: 275px;
}
#Layer4 {
    position:absolute;
    width:82px;
    height:35px;
    z-index:3;
    left: 516px;
    top: 320px;
}
#Layer5 {
    position:absolute;
    width:60px;
    height:29px;
    z-index:4;
    left: 524px;
    top: 328px;
}
#Layer6 {
    position:absolute;
    width:130px;
    height:55px;
    z-index:5;
    left: 311px;
    top: 210px;
}
#Layer7 {
    position:absolute;
    width:230px;
    height:46px;
    z-index:6;
    left: 441px;
    top: 216px;
}
#Layer8 {
    position:absolute;
    width:200px;
    height:115px;
    z-index:7;
    left: 45px;
    top: 100px;
}
#Layer9 {
    position:absolute;
    width:59px;
    height:28px;
    z-index:7;
    left: 70px;
    top: 96px;
}
#Layer10 {
    position:absolute;
    width:216px;
    height:30px;
    z-index:7;
    left: 453px;
    top: 228px;
}
-->
</style> 
</head>

<body>
<form id="form1" name="form1" method="post" action="loginv02.php">
 <div id="Layer3">
  <select name="department">
   <option>Choose your Department. . . . . . </option>
   <option value="Accounting" <?php if($_POST['department'] == 'Accounting') echo "selected='selected'"; ?>>Accounting</option>
   <option value="Engineering" <?php if($_POST['department'] == 'Engineering') echo "selected='selected'"; ?>>Engineering</option>
   <option value="Finishing_Goods" <?php if($_POST['department'] == 'Finishing_Goods') echo "selected='selected'"; ?>>Finishing Goods</option>
   <option value="HRAD" <?php if($_POST['department'] == 'HRAD') echo "selected='selected'"; ?>>HRAD</option>
   <option value="MIS" <?php if($_POST['department'] == 'MIS') echo "selected='selected'"; ?>>MIS</option>
   <option value="Packaging_and_Design" <?php if($_POST['department'] == 'Packaging_and_Design') echo "selected='selected'"; ?>>Packaging and Design</option>
   <option value="Production" <?php if($_POST['department'] == 'Production') echo "selected='selected'"; ?>>Production</option>
   <option value="Purchasing_Logistic" <?php if($_POST['department'] == 'Purchasing_Logistic') echo "selected='selected'"; ?>>Purchasing and Logistics</option>
   <option value="QA_and_Technical" <?php if($_POST['department'] == 'QA_and_Technical') echo "selected='selected'"; ?>>QA and Technical</option>
   <option value="Supply_Chain" <?php if($_POST['department'] == 'Supply_Chain') echo "selected='selected'"; ?>>Supply Chain</option>
                </select>
 </div>
 <div id="Layer5">
  <input type="submit" name="Submit" value="Submit" />
 </div>
 <div id="Layer2"><img src="layout_image/subframev02.png" width="229" height="50" /></div>
 <div id="Layer4"><img src="layout_image/subframev02.png" width="80" height="46" /></div>

<div id="Layer6"><img src="layout_image/userv01.png" width="131" height="62" /></div>
<div id="Layer7"><img src="layout_image/subframev02.png" width="229" height="50" /></div>
<div id="Layer10">
 <input name="username" type="text" size="30" id="username" />

    <?php
    if(isset($err)) {
      echo $err;
    }
    ?>
</div>
</form>
</body>
</html>
  1. <head>
  2. <script> 
  3.    function onKeyEnter(e) { 
  4.      var ENTER_KEY = 13; 
  5.      var code = ""; 
  6.      
  7.      if (window.event){ // IE 
  8.        code = e.keyCode; 
  9.      }else if (e.which){ // Netscape/Firefox/Opera 
  10.        code = e.which; 
  11.      } 
  12.         
  13.      if (code == ENTER_KEY) { 
  14.        formname.select.focus() 
  15.      } 
  16. </script>
  17. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  18. <title>Untitled Document</title>
  19. <style type="text/css">
  20. <!--
  21. BODY {
  22. background-image: url(layout_image/bgroundv03.png);
  23. background-attachment: fixed;
  24. }
  25. #Layer1 {
  26.     position:absolute;
  27.     width:200px;
  28.     height:115px;
  29.     z-index:1;
  30.     left: 82px;
  31.     top: 95px;
  32. }
  33. #Layer2 {
  34.     position:absolute;
  35.     width:229px;
  36.     height:49px;
  37.     z-index:1;
  38.     left: 441px;
  39.     top: 262px;
  40. }
  41. #Layer3 {
  42.     position:absolute;
  43.     width:186px;
  44.     height:32px;
  45.     z-index:2;
  46.     left: 452px;
  47.     top: 275px;
  48. }
  49. #Layer4 {
  50.     position:absolute;
  51.     width:82px;
  52.     height:35px;
  53.     z-index:3;
  54.     left: 516px;
  55.     top: 320px;
  56. }
  57. #Layer5 {
  58.     position:absolute;
  59.     width:60px;
  60.     height:29px;
  61.     z-index:4;
  62.     left: 524px;
  63.     top: 328px;
  64. }
  65. #Layer6 {
  66.     position:absolute;
  67.     width:130px;
  68.     height:55px;
  69.     z-index:5;
  70.     left: 311px;
  71.     top: 210px;
  72. }
  73. #Layer7 {
  74.     position:absolute;
  75.     width:230px;
  76.     height:46px;
  77.     z-index:6;
  78.     left: 441px;
  79.     top: 216px;
  80. }
  81. #Layer8 {
  82.     position:absolute;
  83.     width:200px;
  84.     height:115px;
  85.     z-index:7;
  86.     left: 45px;
  87.     top: 100px;
  88. }
  89. #Layer9 {
  90.     position:absolute;
  91.     width:59px;
  92.     height:28px;
  93.     z-index:7;
  94.     left: 70px;
  95.     top: 96px;
  96. }
  97. #Layer10 {
  98.     position:absolute;
  99.     width:216px;
  100.     height:30px;
  101.     z-index:7;
  102.     left: 453px;
  103.     top: 228px;
  104. }
  105. -->
  106. </style> 
  107. </head>
  108. <body>
  109. <form id="form1" name="form1" method="post" action="loginv02.php">
  110.  <div id="Layer3">
  111.   <select name="department">
  112.    <option>Choose your Department. . . . . . </option>
  113.    <option value="Accounting" <?php if($_POST['department'] == 'Accounting') echo "selected='selected'"; ?>>Accounting</option>
  114.    <option value="Engineering" <?php if($_POST['department'] == 'Engineering') echo "selected='selected'"; ?>>Engineering</option>
  115.    <option value="Finishing_Goods" <?php if($_POST['department'] == 'Finishing_Goods') echo "selected='selected'"; ?>>Finishing Goods</option>
  116.    <option value="HRAD" <?php if($_POST['department'] == 'HRAD') echo "selected='selected'"; ?>>HRAD</option>
  117.    <option value="MIS" <?php if($_POST['department'] == 'MIS') echo "selected='selected'"; ?>>MIS</option>
  118.    <option value="Packaging_and_Design" <?php if($_POST['department'] == 'Packaging_and_Design') echo "selected='selected'"; ?>>Packaging and Design</option>
  119.    <option value="Production" <?php if($_POST['department'] == 'Production') echo "selected='selected'"; ?>>Production</option>
  120.    <option value="Purchasing_Logistic" <?php if($_POST['department'] == 'Purchasing_Logistic') echo "selected='selected'"; ?>>Purchasing and Logistics</option>
  121.    <option value="QA_and_Technical" <?php if($_POST['department'] == 'QA_and_Technical') echo "selected='selected'"; ?>>QA and Technical</option>
  122.    <option value="Supply_Chain" <?php if($_POST['department'] == 'Supply_Chain') echo "selected='selected'"; ?>>Supply Chain</option>
  123.                 </select>
  124.  </div>
  125.  <div id="Layer5">
  126.   <input type="submit" name="Submit" value="Submit" />
  127.  </div>
  128.  <div id="Layer2"><img src="layout_image/subframev02.png" width="229" height="50" /></div>
  129.  <div id="Layer4"><img src="layout_image/subframev02.png" width="80" height="46" /></div>
  130. <div id="Layer6"><img src="layout_image/userv01.png" width="131" height="62" /></div>
  131. <div id="Layer7"><img src="layout_image/subframev02.png" width="229" height="50" /></div>
  132. <div id="Layer10">
  133.  <input name="username" type="text" size="30" id="username" />
  134.     <?php
  135.     if(isset($err)) {
  136.       echo $err;
  137.     }
  138.     ?>
  139. </div>
  140. </form>
  141. </body>
  142. </html>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

I think you might want to rephrase your question. Right now it sounds like a recursive loop

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 57 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.